/* Labubu 2048游戏样式 */

/* 游戏头部 */
.game-header {
    background: white;
    box-shadow: var(--shadow-soft);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.game-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.game-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.back-btn {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition);
}

.back-btn:hover {
    background: var(--bg-secondary);
    color: var(--labubu-pink);
}

.game-stats {
    display: flex;
    gap: 24px;
}

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

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* 设置面板 */
.setup-panel {
    min-height: calc(100vh - 80px);
    background: var(--bg-secondary);
    padding: 32px 0;
}

.setup-content {
    background: white;
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--shadow-soft);
    max-width: 1000px;
    margin: 0 auto;
}

.setup-header h2 {
    color: var(--text-primary);
}

/* 设置区域 */
.settings-section {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--border-radius);
}

/* 模式选择 */
.mode-option {
    position: relative;
}

.mode-label {
    display: block;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    background: white;
}

.mode-label:hover {
    border-color: var(--labubu-pink);
    background: #fef7f7;
}

.mode-option input:checked + .mode-label {
    border-color: var(--labubu-pink);
    background: var(--labubu-pink);
    color: white;
}

.mode-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mode-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.mode-icon {
    font-size: 20px;
}

.mode-title {
    font-weight: 600;
    font-size: 16px;
}

.mode-desc {
    font-size: 14px;
    opacity: 0.8;
}

.setting-item {
    padding: 12px 0;
}

.start-game-btn {
    background: linear-gradient(135deg, var(--labubu-pink), #ec4899);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
    font-size: 16px;
}

.start-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* 游戏主体 */
.game-main {
    padding: 24px 0;
    min-height: calc(100vh - 80px);
    background: var(--bg-secondary);
}

.game-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 游戏区域 */
.game-area {
    background: white;
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
}

.game-board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.game-board {
    position: relative;
    width: 480px;
    height: 480px;
    background: #bbada0;
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

/* 背景网格 */
.grid-background {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 8px;
}

.grid-cell {
    background: rgba(238, 228, 218, 0.35);
    border-radius: 8px;
}

/* 方块容器 */
.tiles-container {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    z-index: 10;
}

/* 游戏方块 */
.game-tile {
    position: absolute;
    width: 108px;
    height: 108px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-family: 'Arial', sans-serif;
    transition: all 0.15s ease-in-out;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    user-select: none;
}

/* 方块移动动画 */
.game-tile.moving {
    transition: all 0.15s ease-in-out;
    z-index: 20;
}

/* 方块合并动画 */
.game-tile.merging {
    animation: mergeAnimation 0.15s ease-in-out;
    z-index: 30;
}

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

/* 新方块出现动画 */
.game-tile.new {
    animation: appearAnimation 0.2s ease-in-out;
}

@keyframes appearAnimation {
    0% { 
        transform: scale(0);
        opacity: 0;
    }
    100% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* 方块颜色样式 */
.tile-2 {
    background: linear-gradient(135deg, #eee4da, #ede0c8);
    color: #776e65;
    font-size: 32px;
}

.tile-4 {
    background: linear-gradient(135deg, #ede0c8, #f2b179);
    color: #776e65;
    font-size: 32px;
}

.tile-8 {
    background: linear-gradient(135deg, #f2b179, #f59563);
    color: #f9f6f2;
    font-size: 32px;
}

.tile-16 {
    background: linear-gradient(135deg, #f59563, #f67c5f);
    color: #f9f6f2;
    font-size: 30px;
}

.tile-32 {
    background: linear-gradient(135deg, #f67c5f, #f65e3b);
    color: #f9f6f2;
    font-size: 30px;
}

.tile-64 {
    background: linear-gradient(135deg, #f65e3b, #edcf72);
    color: #f9f6f2;
    font-size: 30px;
}

.tile-128 {
    background: linear-gradient(135deg, #edcf72, #edcc61);
    color: #f9f6f2;
    font-size: 28px;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.2);
}

.tile-256 {
    background: linear-gradient(135deg, #edcc61, #edc850);
    color: #f9f6f2;
    font-size: 28px;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.3);
}

.tile-512 {
    background: linear-gradient(135deg, #edc850, #edc53f);
    color: #f9f6f2;
    font-size: 28px;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.4);
}

.tile-1024 {
    background: linear-gradient(135deg, #edc53f, #edc22e);
    color: #f9f6f2;
    font-size: 24px;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.5);
}

.tile-2048 {
    background: linear-gradient(135deg, #edc22e, #3c3a32);
    color: #f9f6f2;
    font-size: 24px;
    box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.6);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 30px 10px rgba(243, 215, 116, 0.6); }
    to { box-shadow: 0 0 40px 15px rgba(243, 215, 116, 0.8); }
}

/* 超级方块样式 */
.tile-4096 {
    background: linear-gradient(135deg, #3c3a32, #ff6b6b);
    color: #f9f6f2;
    font-size: 22px;
    box-shadow: 0 0 30px 10px rgba(255, 107, 107, 0.6);
}

.tile-8192 {
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4);
    color: #f9f6f2;
    font-size: 20px;
    box-shadow: 0 0 30px 10px rgba(78, 205, 196, 0.6);
}

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

.control-btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.undo-btn {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
}

.restart-btn {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

.pause-btn {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
}

.hint-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.control-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 侧边栏 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-card {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
}

.info-card h4 {
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* 进度信息 */
.progress-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.progress-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Labubu进化链 */
.evolution-chain {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.evolution-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.evolution-item:hover {
    background: var(--bg-secondary);
}

.evolution-item.achieved {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    animation: pulse 2s infinite;
}

.labubu-tile {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* 操作提示 */
.controls-hint {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hint-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hint-keys {
    display: flex;
    gap: 4px;
}

.key {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    min-width: 24px;
    text-align: center;
}

.hint-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 游戏覆盖层 */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.overlay-content {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-hover);
    animation: overlayAppear 0.3s ease-out;
}

@keyframes overlayAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.overlay-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.overlay-content h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.overlay-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.overlay-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

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

.overlay-stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.overlay-stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.overlay-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--labubu-pink), #ec4899);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid #e5e7eb;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* 粒子效果 */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--labubu-pink);
    border-radius: 50%;
    animation: particleFloat 1s ease-out forwards;
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) translateY(-100px);
    }
}

/* 分数飞出效果 */
.score-popup {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: #10b981;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    animation: scorePopup 1s ease-out forwards;
    pointer-events: none;
    z-index: 100;
}

@keyframes scorePopup {
    0% { 
        transform: scale(0.5) translateY(0);
        opacity: 0;
    }
    30% { 
        transform: scale(1.2) translateY(-20px);
        opacity: 1;
    }
    100% { 
        transform: scale(1) translateY(-60px);
        opacity: 0;
    }
}

/* 成就效果 */
.achievement-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    padding: 20px 30px;
    border-radius: 16px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: achievementAnimation 3s ease-in-out forwards;
    z-index: 1001;
}

@keyframes achievementAnimation {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .game-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .sidebar {
        order: -1;
    }
    
    .sidebar .info-card {
        padding: 16px;
    }
    
    .evolution-chain {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 768px) {
    .setup-content {
        padding: 24px 16px;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .game-stats {
        justify-content: center;
    }
    
    .game-board {
        width: 320px;
        height: 320px;
        padding: 6px;
    }
    
    .game-tile {
        width: 72px;
        height: 72px;
        font-size: 20px;
    }
    
    .tile-128, .tile-256, .tile-512 {
        font-size: 18px;
    }
    
    .tile-1024, .tile-2048 {
        font-size: 16px;
    }
    
    .overlay-content {
        padding: 24px;
    }
    
    .overlay-buttons {
        flex-direction: column;
    }
    
    .game-controls {
        justify-content: center;
    }
    
    .progress-info {
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .game-title h1 {
        font-size: 1.5rem;
    }
    
    .stat-value {
        font-size: 16px;
    }
    
    .game-board {
        width: 280px;
        height: 280px;
        padding: 4px;
    }
    
    .game-tile {
        width: 64px;
        height: 64px;
        font-size: 18px;
    }
    
    .tile-128, .tile-256, .tile-512 {
        font-size: 16px;
    }
    
    .tile-1024, .tile-2048 {
        font-size: 14px;
    }
    
    .setup-content {
        padding: 16px;
    }
    
    .settings-section {
        padding: 16px;
    }
    
    .mode-label {
        padding: 12px;
    }
    
    .evolution-chain {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .labubu-tile {
        width: 32px;
        height: 32px;
        font-size: 10px;
    }
    
    .control-btn {
        padding: 10px 16px;
        font-size: 12px;
    }
}

/* 工具类 */
.hidden {
    display: none !important;
}

.disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* 暂停状态 */
.game-paused .game-board {
    filter: blur(5px);
    pointer-events: none;
}

.game-paused .game-tile {
    cursor: default;
}

/* 加载状态 */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .game-board {
        touch-action: none;
    }
    
    .control-btn:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .game-tile {
        border: 2px solid #000;
    }
    
    .tile-2, .tile-4 {
        color: #000;
    }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
    .game-tile {
        transition: none;
    }
    
    .game-tile.moving {
        transition: none;
    }
    
    .game-tile.new {
        animation: none;
    }
    
    .game-tile.merging {
        animation: none;
    }
    
    .particle {
        animation: none;
    }
    
    .score-popup {
        animation: none;
    }
    
    .achievement-popup {
        animation: none;
    }
}
