/* ===== 强制横屏 ===== */
/* 检测竖屏并强制旋转 */
@media screen and (orientation: portrait) {
    body {
        transform: rotate(90deg);
        transform-origin: left top;
        width: 100vh;
        height: 100vw;
        position: fixed;
        top: 0;
        left: 0;
        overflow: hidden;
    }
}

/* 微信浏览器特殊处理 */
@media screen and (max-aspect-ratio: 1/1) {
    body {
        transform: rotate(90deg);
        transform-origin: left top;
        width: 100vh;
        height: 100vw;
        position: fixed;
        top: 0;
        left: 0;
        overflow: hidden;
    }
}

/* ===== 页面基底 ===== */
html, body {
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #1a0a2e 0%, #2d1b4e 50%, #1a0a2e 100%);
    color: #fff;
    overflow: hidden;
}

.page {
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #1a0a2e 0%, #2d1b4e 50%, #1a0a2e 100%);
    color: #fff;
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== 背景星星粒子 ===== */
.stars-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.star {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
    animation: twinkle ease-in-out infinite;
}

.star-1 { top: 8%; left: 10%; animation-duration: 2.4s; }
.star-2 { top: 20%; left: 72%; animation-duration: 3.1s; width: 3px; height: 3px; }
.star-3 { top: 55%; left: 85%; animation-duration: 2.8s; }
.star-4 { top: 12%; left: 38%; animation-duration: 3.5s; width: 3px; height: 3px; }
.star-5 { top: 68%; left: 14%; animation-duration: 2.1s; width: 5px; height: 5px; }
.star-6 { top: 40%; left: 55%; animation-duration: 2.9s; width: 3px; height: 3px; }
.star-7 { top: 78%; left: 45%; animation-duration: 3.3s; }
.star-8 { top: 32%; left: 92%; animation-duration: 2.6s; width: 3px; height: 3px; }

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.5); }
}

/* ===== 顶部状态栏 ===== */
.top-bar {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 60px;
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(20,10,40,0.95) 0%, rgba(35,20,60,0.85) 60%, rgba(45,27,78,0.4) 100%);
    border-bottom: 1px solid rgba(255,215,0,0.15);
    box-sizing: border-box;
    position: relative;
    z-index: 2;
    backdrop-filter: blur(10px);
}

/* 顶部发光细线 */
.top-bar-glow {
    position: absolute;
    bottom: -1px;
    left: 5%;
    width: 90%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,215,0,0.5) 20%, rgba(255,215,0,0.6) 50%, rgba(255,215,0,0.5) 80%, transparent);
    filter: blur(2px);
}

.user-info {
    display: flex;
    align-items: center;
    width: 170px;
    flex-shrink: 0;
}

.avatar {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    overflow: hidden;
    margin-right: 8px;
    flex-shrink: 0;
    position: relative;
}

/* 头像外圈金光 */
.avatar-ring {
    position: absolute;
    inset: -3px;
    border-radius: 14px;
    border: 2px solid #ffd700;
    box-shadow: 0 0 8px rgba(255,215,0,0.4);
    z-index: 2;
    pointer-events: none;
}

.avatar-img {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
    object-fit: cover;
}

.avatar-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ff9a56, #ff6b6b);
    position: relative;
    z-index: 1;
}

.user-detail {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.nickname {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    line-height: 1.2;
}

.gold-box {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, rgba(139,69,19,0.8), rgba(160,82,45,0.8));
    padding: 1px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255,215,0,0.5);
    box-shadow: 0 0 6px rgba(255,215,0,0.15);
}

.gold-icon-symbol {
    font-size: 12px;
    color: #ffd700;
    margin-right: 4px;
}

.gold-num {
    font-size: 14px;
    color: #ffd700;
    font-weight: bold;
}

.top-title {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

/* 标题两侧装饰线 */
.title-deco {
    width: 28px;
    height: 2px;
    background: linear-gradient(to right, transparent, rgba(255,215,0,0.6));
    border-radius: 1px;
}

.title-deco:last-child {
    background: linear-gradient(to left, transparent, rgba(255,215,0,0.6));
}

.title-text {
    font-size: 28px;
    font-weight: 800;
    color: #ffd700;
    text-shadow: 0 0 12px rgba(255,215,0,0.5), 0 2px 4px rgba(0,0,0,0.4);
    letter-spacing: 2px;
}

.top-btns {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    gap: 8px;
}

.top-btn {
    display: flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.2s;
    cursor: pointer;
}

.top-btn:hover {
    background: rgba(255,255,255,0.18);
}

.top-btn:active {
    background: rgba(255,255,255,0.18);
    transform: scale(0.95);
}

.btn-text {
    font-size: 18px;
    color: rgba(255,255,255,0.85);
    font-weight: 500;
}

/* ===== 游戏分类卡片 ===== */
.category-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 30px 20px;
    gap: 20px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

/* 卡片入场动画 */
.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 210px;
    height: 250px;
    background: linear-gradient(145deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.18);
    box-shadow:
        0 8px 32px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.15),
        inset 0 -1px 0 rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.85) translateY(30px);
    cursor: pointer;
    transition: all 0.2s;
}

.category-card.card-in {
    animation: cardEnter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cardEnter {
    0% { opacity: 0; transform: scale(0.85) translateY(30px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* 卡片悬停浮动 */
@keyframes cardFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.category-card.card-in {
    animation: cardEnter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, 
               cardFloat 3s ease-in-out infinite;
}

.paohuzi.card-in {
    animation: cardEnter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, 
               cardFloat 3s ease-in-out 0s infinite;
}

.majiang.card-in {
    animation: cardEnter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, 
               cardFloat 3s ease-in-out 0.3s infinite;
}

.puke.card-in {
    animation: cardEnter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, 
               cardFloat 3s ease-in-out 0.6s infinite;
}

/* 卡片顶部扫光 */
.category-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255,255,255,0.12) 50%,
        transparent 60%
    );
    transition: transform 0.6s;
    transform: translateX(-100%);
}

.category-card:hover::before,
.category-card:active::before {
    transform: translateX(100%);
}

/* 卡片底部光晕 */
.category-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    width: 80%;
    height: 60%;
    background: radial-gradient(ellipse at center bottom, var(--card-glow), transparent 70%);
    opacity: 0.3;
    pointer-events: none;
}

.category-card.paohuzi {
    --card-glow: rgba(255,107,107,0.5);
}

.category-card.majiang {
    --card-glow: rgba(78,205,196,0.5);
}

.category-card.puke {
    --card-glow: rgba(165,94,234,0.5);
}

.cat-icon-wrap {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-bottom: 16px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 图标外圈光晕 */
.cat-icon-wrap::before {
    content: '';
    position: absolute;
    width: 120%;
    height: 120%;
    border-radius: 50%;
    background: inherit;
    filter: blur(20px);
    opacity: 0.5;
    z-index: -1;
}

/* 图标内层光效 */
.cat-icon-wrap::after {
    content: '';
    position: absolute;
    top: 10%;
    left: 15%;
    width: 30%;
    height: 20%;
    background: rgba(255,255,255,0.4);
    border-radius: 50%;
    filter: blur(4px);
}

.cat-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 8px 20px rgba(0,0,0,0.3),
        inset 0 2px 4px rgba(255,255,255,0.3),
        inset 0 -2px 4px rgba(0,0,0,0.2);
}

.cat-icon span {
    font-size: 40px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

.category-card.paohuzi .cat-icon {
    background: linear-gradient(145deg, #ff7b7b, #ee5a5a, #cc4a4a);
}

.category-card.majiang .cat-icon {
    background: linear-gradient(145deg, #5ed9d0, #4ecdc4, #3db3ab);
}

.category-card.puke .cat-icon {
    background: linear-gradient(145deg, #b06eea, #a55eea, #8544d0);
}

.cat-name {
    font-size: 28px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 2px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    position: relative;
    z-index: 1;
}

/* 底部装饰线 */
.category-card .card-line {
    position: absolute;
    bottom: 24px;
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
}

/* 横屏响应式优化 */
@media screen and (max-width: 1024px) {
    .category-card {
        width: 180px;
        height: 220px;
    }
    
    .cat-icon-wrap {
        width: 90px;
        height: 90px;
    }
    
    .cat-icon {
        width: 70px;
        height: 70px;
    }
    
    .cat-icon span {
        font-size: 36px;
    }
    
    .cat-name {
        font-size: 24px;
    }
}

@media screen and (max-width: 768px) {
    .top-bar {
        padding: 0 15px;
        height: 50px;
    }
    
    .user-info {
        width: 140px;
    }
    
    .avatar {
        width: 40px;
        height: 40px;
    }
    
    .nickname {
        font-size: 16px;
    }
    
    .gold-num {
        font-size: 12px;
    }
    
    .title-text {
        font-size: 22px;
    }
    
    .top-btn {
        padding: 4px 10px;
    }
    
    .btn-text {
        font-size: 14px;
    }
    
    .category-container {
        padding: 0 20px 15px;
        gap: 15px;
    }
    
    .category-card {
        width: 160px;
        height: 200px;
    }
    
    .cat-icon-wrap {
        width: 80px;
        height: 80px;
        margin-bottom: 12px;
    }
    
    .cat-icon {
        width: 60px;
        height: 60px;
    }
    
    .cat-icon span {
        font-size: 32px;
    }
    
    .cat-name {
        font-size: 22px;
    }
}