/* ===== 全局重置（与主站一致） ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    background: #f6f8fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ====================================================
           导航栏（透明，悬浮）
           ==================================================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: transparent;
    box-shadow: none;
    padding: 0 25px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.navbar .nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.navbar .nav-brand {
    font-size: 0.8rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.3px;
    transition: 0.2s;
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.navbar .nav-brand:hover {
    color: #ffd700;
}
.navbar .nav-menu a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 3px 11px;
    border-radius: 11px;
    font-weight: 500;
    font-size: 0.68rem;
    transition: 0.2s;
    white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.navbar .nav-menu a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}
.navbar .nav-menu a.active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}
.navbar .user-area {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.navbar .user-area .login-btn,
.navbar .user-area .register-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 2px 11px;
    border-radius: 11px;
    font-weight: 500;
    font-size: 0.64rem;
    color: #ffffff;
    cursor: pointer;
    transition: 0.2s;
    line-height: 1.6;
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.navbar .user-area .login-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #ffffff;
}
.navbar .user-area .register-btn {
    background: rgba(255, 255, 255, 0.2);
}
.navbar .user-area .register-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}
.navbar .user-area .avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.64rem;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.3);
}

/* ====================================================
           品牌横幅（80%尺寸）
           ==================================================== */
.hero-banner {
    width: 100%;
    height: 144px;
    background: linear-gradient(135deg, #1a3c8c 0%, #5b7cfa 100%);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 48px;
    color: #ffffff;
    flex-shrink: 0;
    position: relative;
    margin-top: -35px;
    z-index: 0;
}
.hero-banner .banner-content {
    position: relative;
    z-index: 2;
    text-align: left;
}
.hero-banner .logo {
    font-size: 2.9rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    color: #ffd700;
}
.hero-banner .slogan {
    font-size: 0.8rem;
    font-weight: 300;
    margin-top: 4px;
    opacity: 0.85;
    letter-spacing: 4px;
}

/* ====================================================
           游戏主区域
           ==================================================== */
.main-content {
    flex: 1;
    background: #f6f8fa;
    padding: 20px 32px 40px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.game-wrapper {
    max-width: 550px;
    width: 100%;
    background: #ffffff;
    border-radius: 16px;
    padding: 24px 28px 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid #edf2f7;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.game-header .title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1e1e2e;
}
.game-header .score-area {
    display: flex;
    gap: 20px;
    font-size: 0.95rem;
    color: #4a4a5a;
}
.game-header .score-area span {
    font-weight: 600;
    color: #1e1e2e;
}

/* 2048 网格容器 */
.grid-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}
#gridContainer {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    background: #bbada0;
    border-radius: 12px;
    padding: 8px;
    width: 100%;
    max-width: 420px;
    aspect-ratio: 1 / 1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    user-select: none;
    touch-action: none;
}

.cell {
    background: #cdc1b4;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.8rem;
    color: #776e65;
    transition: all 0.12s ease;
    aspect-ratio: 1 / 1;
}

/* 各数字颜色（经典2048配色） */
.cell[data-value="2"]   { background: #eee4da; color: #776e65; }
.cell[data-value="4"]   { background: #ede0c8; color: #776e65; }
.cell[data-value="8"]   { background: #f2b179; color: #f9f6f2; }
.cell[data-value="16"]  { background: #f59563; color: #f9f6f2; }
.cell[data-value="32"]  { background: #f67c5f; color: #f9f6f2; }
.cell[data-value="64"]  { background: #f65e3b; color: #f9f6f2; }
.cell[data-value="128"] { background: #edcf72; color: #f9f6f2; }
.cell[data-value="256"] { background: #edcc61; color: #f9f6f2; }
.cell[data-value="512"] { background: #edc850; color: #f9f6f2; }
.cell[data-value="1024"]{ background: #edc53f; color: #f9f6f2; font-size: 1.5rem; }
.cell[data-value="2048"]{ background: #edc22e; color: #f9f6f2; font-size: 1.5rem; }
.cell[data-value="4096"]{ background: #3c3a32; color: #f9f6f2; font-size: 1.2rem; }
.cell[data-value="8192"]{ background: #3c3a32; color: #f9f6f2; font-size: 1.2rem; }

/* 小屏适配数字大小 */
@media (max-width: 480px) {
    .cell[data-value] { font-size: 1.4rem; }
    .cell[data-value="1024"] { font-size: 1.1rem; }
    .cell[data-value="2048"] { font-size: 1.1rem; }
    .cell[data-value="4096"] { font-size: 0.9rem; }
    .cell[data-value="8192"] { font-size: 0.9rem; }
}
@media (max-width: 380px) {
    #gridContainer { gap: 5px; padding: 5px; }
    .cell[data-value] { font-size: 1.0rem; }
}

/* ===== 游戏控制按钮 ===== */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.game-controls button {
    padding: 8px 28px;
    border: none;
    border-radius: 24px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.2s;
    background: #5b7cfa;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(91, 124, 250, 0.25);
}
.game-controls button:hover:not(:disabled) {
    background: #4a6adf;
    transform: translateY(-2px);
}
.game-controls button:active:not(:disabled) {
    transform: translateY(0);
}
.game-controls button.secondary {
    background: #eef2f7;
    color: #2d2d44;
    box-shadow: none;
}
.game-controls button.secondary:hover:not(:disabled) {
    background: #e2e8f0;
}
.game-controls button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
}

.game-status {
    text-align: center;
    margin-top: 14px;
    font-size: 0.95rem;
    color: #5a5a72;
    min-height: 1.6em;
}
.game-status .highlight {
    color: #5b7cfa;
    font-weight: 600;
}
.game-status .win {
    color: #22c55e;
    font-weight: 600;
}
.game-status .lose {
    color: #ef4444;
    font-weight: 600;
}

/* ===== 响应式适配 ===== */
@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
        height: 32px;
    }
    .navbar .nav-left {
        gap: 12px;
    }
    .navbar .nav-brand {
        font-size: 0.68rem;
    }
    .navbar .nav-menu a {
        padding: 2px 8px;
        font-size: 0.6rem;
        border-radius: 10px;
    }
    .navbar .user-area .login-btn,
    .navbar .user-area .register-btn {
        padding: 2px 8px;
        font-size: 0.56rem;
    }
    .navbar .user-area .avatar {
        width: 20px;
        height: 20px;
        font-size: 0.56rem;
    }
    .hero-banner {
        height: 104px;
        padding-left: 24px;
        margin-top: -32px;
    }
    .hero-banner .logo {
        font-size: 1.9rem;
    }
    .hero-banner .slogan {
        font-size: 0.68rem;
    }
    .main-content {
        padding: 16px 16px 30px;
    }
    .game-wrapper {
        padding: 18px 16px 22px;
    }
    .game-header .title {
        font-size: 1.2rem;
    }
    .game-header .score-area {
        font-size: 0.85rem;
        gap: 14px;
    }
    .game-controls button {
        padding: 6px 20px;
        font-size: 0.8rem;
    }
}
@media (max-width: 480px) {
    .navbar {
        padding: 0 10px;
        height: 28px;
    }
    .navbar .nav-left {
        gap: 6px;
    }
    .navbar .nav-brand {
        font-size: 0.6rem;
    }
    .navbar .nav-menu a {
        padding: 2px 5px;
        font-size: 0.52rem;
        border-radius: 8px;
    }
    .navbar .user-area .login-btn,
    .navbar .user-area .register-btn {
        padding: 1px 6px;
        font-size: 0.48rem;
        border-radius: 8px;
    }
    .navbar .user-area .avatar {
        width: 16px;
        height: 16px;
        font-size: 0.48rem;
    }
    .hero-banner {
        height: 80px;
        padding-left: 16px;
        margin-top: -28px;
    }
    .hero-banner .logo {
        font-size: 1.4rem;
    }
    .hero-banner .slogan {
        font-size: 0.56rem;
        letter-spacing: 1px;
    }
    .main-content {
        padding: 12px 10px 24px;
    }
    .game-wrapper {
        padding: 14px 12px 18px;
    }
    .game-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .game-header .score-area {
        justify-content: space-between;
    }
    .game-controls {
        gap: 10px;
    }
    .game-controls button {
        padding: 6px 16px;
        font-size: 0.75rem;
        flex: 1;
    }
}