:root {
    /* Exchange Professional Palette - White & Gold */
    --bg-main: #f4f7f9;
    --bg-white: #ffffff;
    --bg-sidebar: #ffffff;
    --accent-gold: #c5a021;
    --accent-gold-light: #fdfaf0;
    --accent-gold-dark: #a68418;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-light: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    
    /* Dimensions */
    --sidebar-width: 260px;
    --header-height: 64px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}


/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-logo {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: -0.5px;
}

.sidebar-menu {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

/* Sidebar Menu Item Icon & Text */
.menu-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    margin-bottom: 4px;
}

.menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    transition: all 0.2s;
    color: var(--text-muted);
}

.menu-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2.25;
}

.menu-item:hover .menu-icon, 
.menu-item.active .menu-icon {
    color: var(--accent-gold);
}

.menu-item:hover, .menu-item.active {
    color: var(--accent-gold);
    background: var(--accent-gold-light);
}

/* Main Layout */
.main-layout {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-width));
    min-width: 0; /* Prevent flex-item overflow */
}


/* Header Logo */
.header-logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-circle {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #ffd700, #c5a021);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    font-weight: 900;
    box-shadow: 0 4px 10px rgba(197, 160, 33, 0.3);
}

/* Site logo image (no text, no effects). Keep aspect ratio for long images. */
.site-logo-img {
    display: block;
    height: 100%;
    width: auto;
    max-width: 220px;
    object-fit: contain;
}

.has-site-logo .logo-circle {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    width: auto;
}

.has-site-logo .logo-text {
    display: none;
}

.has-site-logo .sidebar-logo {
    color: inherit;
    letter-spacing: 0;
    font-size: 0;
}

.has-site-logo .sidebar-logo .site-logo-img--sidebar {
    height: 28px;
    max-width: 220px;
}


.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-text .brand {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1;
}

.logo-text .tagline {
    font-size: 0.65rem;
    color: var(--accent-gold);
    font-weight: 700;
    letter-spacing: 1px;
    margin-top: 2px;
}

.top-nav {
    height: var(--header-height);
    background: var(--bg-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 90;
}

/* Sub Pages Header (same as order_detail.html) */
body.detail-page {
    display: block;
    background: var(--bg-main);
    padding-top: 56px;
}

.detail-top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.detail-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.2s;
}

.detail-back-btn:hover {
    background: var(--bg-main);
}

.detail-nav-title {
    flex: 1;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 16px;
}

.detail-nav-placeholder {
    width: 36px;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-gold-light);
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid var(--border-light);
}

.avatar-circle:hover {
    background: var(--accent-gold);
    color: white;
}

.header-auth-btns {
    display: flex;
    align-items: center;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}


.user-panel {
    display: flex;
    align-items: center;
    gap: 16px;
}

.balance-box {
    background: #fff;
    padding: 6px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.balance-amount {
    color: var(--text-primary);
    font-weight: 700;
    font-family: 'Roboto Mono', monospace;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.amount-input {
    height: 44px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 0 12px;
    font-size: 1rem;
    font-weight: 600;
    outline: none;
    transition: border-color 0.2s;
    background: #fff;
}
.amount-input:focus { border-color: var(--accent-gold); }


.btn-primary { background: var(--accent-gold); color: white; }
.btn-primary:hover { background: var(--accent-gold-dark); box-shadow: 0 4px 12px rgba(197, 160, 33, 0.2); }
.btn-outline { background: transparent; border: 1px solid var(--border-light); color: var(--text-secondary); }
.btn-outline:hover { background: #f8fafc; border-color: var(--text-muted); }

/* Content Area */
.content-wrapper {
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Carousel */
.carousel-container {
    width: 100%;
    height: clamp(160px, 24vw, 360px);
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}


.carousel-slide {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.6s ease;
    display: flex;
    align-items: center;
    padding: 0 60px;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-position: center;
}


.carousel-slide.active { opacity: 1; z-index: 1; }
.slide-content h2 { font-size: 2.5rem; color: white; font-weight: 800; margin-bottom: 12px; letter-spacing: -1px; }
.slide-content p { font-size: 1.125rem; color: rgba(255,255,255,0.9); margin-bottom: 24px; max-width: 500px; }

/* Announcement Bar */
.announcement-bar {
    background: var(--bg-white);
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    margin-bottom: 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.announcement-icon { font-size: 1.2rem; margin-right: 15px; }
.announcement-bar .marquee-container { flex: 1; overflow: hidden; position: relative; }
.marquee-content { white-space: nowrap; display: inline-block; animation: marquee 30s linear infinite; }

@keyframes marquee {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.popular-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: transparent;
    border: none;
    gap: 16px;
    margin-bottom: 32px;
}

.popular-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.popular-item:hover {
    transform: translateY(-4px);
    background: var(--bg-white);
    border-color: var(--accent-gold);
    box-shadow: var(--shadow-md);
}

.popular-icon-circle {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    color: #fff;
    font-weight: 900;
    font-size: 0.8rem;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.popular-icon-circle.k3, .app-card-icon.k3 { background: linear-gradient(135deg, #ff7875, #ff4d4f); }
.popular-icon-circle.pk10, .app-card-icon.pk10 { background: linear-gradient(135deg, #ff85c0, #f759ab); }
.popular-icon-circle.ssc, .app-card-icon.ssc { background: linear-gradient(135deg, #ffc069, #ffa940); }
.popular-icon-circle.other, .app-card-icon.other { background: linear-gradient(135deg, #69c0ff, #40a9ff); }

.popular-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.popular-info {
    font-size: 0.75rem;
    color: #999;
}

.hall-item-draw {
    margin-top: 12px;
    width: 100%;
    display: flex;
    justify-content: center;
    overflow: hidden;
}


/* Home Section Layout */
.home-section {
    margin-bottom: 32px;
}

.home-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
    margin-bottom: 16px;
}

.home-section-header h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    position: relative;
    padding-left: 14px;
}

.home-section-header h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 18px;
    background: var(--accent-gold);
    border-radius: 2px;
}

.home-section-header .all-link {
    font-size: 0.9rem;
    color: var(--accent-gold);
    text-decoration: none;
    font-weight: 600;
}

/* Home Navigation Grid */
.home-nav-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.nav-item {
    background: var(--bg-white);
    padding: 20px 10px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.nav-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-gold);
}

.nav-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.nav-icon svg {
    width: 28px;
    height: 28px;
}

.nav-icon.recharge { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #d97706; }
.nav-icon.withdraw { background: linear-gradient(135deg, #dcfce7, #bbf7d0); color: #15803d; }
.nav-icon.service { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #1d4ed8; }
.nav-icon.activity { background: linear-gradient(135deg, #fce7f3, #fbcfe8); color: #be185d; }


/* Hall Grid */
.hall-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Unified Game Item Styles */
.game-item {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0;
}

.game-info-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.game-name-text {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.game-period-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.bet-countdown-mini {
    background: #fff5f5;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #fed7d7;
}

.bet-countdown-mini .countdown-timer {
    font-size: 0.9rem;
    color: #e53e3e;
}

.game-body-lottery {
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #f1f5f9;
}

/* Unified Lottery Number Container (for Cards & Results) */
.lottery-numbers, .draw-numbers {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scroll for iOS */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    width: 100%;
    padding: 2px 4px;
}

.lottery-numbers::-webkit-scrollbar, 
.draw-numbers::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.lottery-numbers > *, 
.draw-numbers > * {
    flex-shrink: 0; /* Prevent items from squishing */
}

/* Ensure the body container doesn't force center if overflowing */
.game-body-lottery {
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px;
    min-height: 60px;
    display: flex;
    align-items: center;
    border: 1px solid #f1f5f9;
    overflow: hidden; /* Contain the scrollable area */
}

/* If numbers fit, center them; if not, align start for scrolling */
.lottery-numbers {
    justify-content: center;
}

@media (max-width: 768px) {
    .lottery-numbers {
        justify-content: flex-start; /* Better for scrolling on mobile */
    }
}

/* Filter Tabs */
.filter-tabs { 
    display: flex; 
    gap: 10px; 
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab { 
    padding: 8px 18px; 
    border-radius: 20px; 
    background: #e2e8f0; 
    font-size: 0.85rem; 
    color: var(--text-secondary); 
    cursor: pointer; 
    transition: all 0.2s; 
    font-weight: 600; 
    white-space: nowrap;
    border: 1px solid transparent;
}
.filter-tab.active { 
    background: var(--accent-gold-light); 
    color: var(--accent-gold); 
    border-color: var(--accent-gold);
}

/* Page Management */
.page-section {
    display: none;
    width: 100%;
}

.page-section.active {
    display: block;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 24px;
    letter-spacing: -0.5px;
}

.section-title .section-subtitle {
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-left: 8px;
}

.section-subtitle {
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--text-secondary);
}


/* Results Page Styles - Refined */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.result-card {
    background: var(--bg-white);
    padding: 18px;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s;
}

.result-card:hover {
    border-color: var(--accent-gold);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.15);
    transform: translateY(-2px);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-name {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-primary);
}

.draw-period {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.draw-numbers {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 12px;
    background: #f8fafc;
    border-radius: 12px;
    scrollbar-width: none; /* Firefox */
    border: 1px solid #f1f5f9;
}

.draw-numbers::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.draw-numbers > * {
    flex-shrink: 0; /* Prevent numbers from squishing */
}

.sum-tag {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-gold);
    background: var(--accent-gold-light);
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    margin-left: 4px;
}

/* Records Page Styles */
.record-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.record-item {
    background: var(--bg-white);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.record-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.record-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.record-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.record-status {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.record-status.success {
    color: var(--success);
}

.record-detail {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
}

.win-amount {
    color: var(--danger);
}

/* Profile Page Styles - Deprecated in favor of Enhanced Styles below */
/* Removing old profile classes to avoid conflicts */
.profile-container-old {
    max-width: 600px;
    margin: 0 auto;
}


/* Lottery Number Styles */
.lottery-numbers, .draw-numbers {
    display: flex;
    gap: 6px;
    align-items: center;
}

.ball {
    width: 28px;
    height: 28px;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.ssc .ball { background: #fef3c7; color: #d97706; border-color: #fcd34d; }
.marksix .ball.red { background: #fee2e2; color: #ef4444; border-color: #fecaca; }
.marksix .ball.blue { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.marksix .ball.gold { background: var(--accent-gold-light); color: var(--accent-gold); border-color: #fde68a; }

.pk10 .num {
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
}

.n1 { background: #eab308; }
.n2 { background: #3b82f6; }
.n3 { background: #475569; }
.n4 { background: #f97316; }
.n5 { background: #06b6d4; }
.n6 { background: #6366f1; }
.n7 { background: #94a3b8; }
.n8 { background: #ef4444; }
.n9 { background: #7c2d12; }
.n10 { background: #22c55e; }

.dice {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    font-weight: 800;
    color: #ef4444;
    line-height: 1;
}


/* Home Category Section - Vertical Tabs Layout */
.home-category-section {
    margin-top: 24px;
    background: var(--bg-white);
    border-radius: 20px;
    border: 1px solid var(--border-light);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.category-tabs-container {
    display: flex;
    align-items: flex-start;
    background: var(--bg-white);
    height: auto; /* 高度由左侧分类数量决定（JS 会同步右侧高度） */
}

/* Sidebar */
.category-vertical-sidebar {
    width: 100px;
    background: transparent;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    align-self: flex-start; /* 侧边栏高度仅由分类项决定 */
    overflow-y: auto; /* 分类过多时侧边栏内部滚动 */
    scrollbar-width: none;
    border-right: 1px solid var(--border-light); /* 分隔线只到最后一个分类项 */
}


.category-vertical-sidebar::-webkit-scrollbar {
    display: none;
}

/* Content Area */
.category-main-content {
    flex: 1;
    padding: 24px;
    background: var(--bg-white);
    height: auto; /* 由 JS 同步为侧边栏高度 */
    overflow-y: auto;
}


.category-sidebar-item {
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(0,0,0,0.03);
    position: relative;
    color: var(--text-secondary);
    background: #f8fafc; /* 灰色只在按钮本身 */
}

.category-sidebar-item:first-child {
    border-top-left-radius: 20px;
}

.category-sidebar-item:last-child {
    border-bottom: none;
    border-bottom-left-radius: 20px;
}

.category-sidebar-item.active {
    background: var(--bg-white);
    color: var(--accent-gold);
}


.category-sidebar-item .item-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
}

.category-sidebar-item .item-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
}

.category-sidebar-item:hover {
    background: rgba(255,255,255,0.5);
}

.category-sidebar-item.active .item-icon {
    opacity: 1;
}

.category-sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: var(--accent-gold);
    border-radius: 0 4px 4px 0;
}


.category-main-content::-webkit-scrollbar {
    width: 4px;
}

.category-main-content::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

.category-main-content .popular-grid {
    grid-template-columns: repeat(2, 1fr);
}

/* App Style Cards */
.lottery-app-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 10px;
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.3s;
    min-height: 150px; /* 确保卡片高度一致性 */
    justify-content: center;
}


.lottery-app-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    border-color: var(--accent-gold);
}

.app-card-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 900;
    color: white;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    background-size: cover;
}

.app-card-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    text-align: center;
}

.app-card-info {
    font-size: 0.7rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .category-vertical-sidebar { width: 80px; }
    .category-main-content { padding: 12px; }
    .lottery-app-card { padding: 16px 8px; }
    .app-card-icon { width: 54px; height: 54px; font-size: 0.9rem; }
}

/* Animations */
.fade-in { 
    opacity: 0;
    animation: fadeIn 0.4s ease forwards; 
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }



/* Responsive PC Mini */
@media (max-width: 1024px) {
    :root { --sidebar-width: 80px; }
    .sidebar-logo span:last-child, .menu-item span:last-child, .menu-title { display: none; }
    .sidebar-logo { justify-content: center; padding: 0; }
    .menu-item { justify-content: center; padding: 12px; }
    .menu-icon { margin: 0; }
    
    .desktop-hide { display: flex !important; }
}

/* Helper to hide redundant logo on desktop */
@media (min-width: 1025px) {
    .desktop-hide { display: none !important; }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body { flex-direction: column; }
    
    .sidebar { 
        width: 94%; 
        height: 66px; 
        left: 3%; 
        right: 3%;
        bottom: 20px; 
        top: auto;
        flex-direction: row; 
        border: 1px solid rgba(255, 255, 255, 0.3);
        background: rgba(255, 255, 255, 0.8);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-radius: 20px;
        justify-content: space-around;
        align-items: center;
        box-shadow: 0 10px 30px rgba(0,0,0,0.15);
        z-index: 1000;
        padding: 0 10px;
        position: fixed; /* Explicitly ensure fixed */
    }


    .sidebar-logo { display: none; }
    
    .sidebar-menu { 
        display: flex; 
        padding: 0; 
        width: 100%; 
        height: 100%; 
        justify-content: space-around;
        align-items: center;
        overflow: visible;
    }


    .menu-item { 
        flex: 1; 
        flex-direction: column; 
        padding: 0; 
        gap: 2px; 
        font-size: 0.7rem; 
        border-radius: 0; 
        justify-content: center;
        align-items: center;
        height: 100%;
        margin-bottom: 0;
        background: transparent !important;
        position: relative;
        overflow: visible;
    }





    .menu-icon {
        width: 24px;
        height: 24px;
        margin-bottom: 2px;
    }

    .menu-icon svg {
        width: 22px;
        height: 22px;
        stroke-width: 2;
    }

    .menu-item span:last-child { 
        display: block !important;
        font-size: 0.6rem; 
        color: var(--text-muted);
        font-weight: 700;
        transition: color 0.2s;
    }

    .menu-item.active .menu-icon {
        color: var(--accent-gold);
    }

    .menu-item.active span:last-child { 
        color: var(--accent-gold); 
    }

    .menu-item.active::after {
        content: '';
        position: absolute;
        bottom: 8px;
        width: 4px;
        height: 4px;
        background: var(--accent-gold);
        border-radius: 50%;
    }




    .home-nav-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        margin-bottom: 24px;
    }
    .nav-item {
        padding: 12px 4px;
        border-radius: 12px;
        font-size: 0.75rem;
        gap: 8px;
    }
    .nav-icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }
    .nav-icon svg {
        width: 20px;
        height: 20px;
    }
    .popular-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .popular-item {
        padding: 16px 8px;
        border-radius: 16px;
    }

    /* hall.html：移动端 3 列图标宫格（按截图风格） */
    #page-hall .popular-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    #page-hall .popular-item {
        padding: 14px 8px;
        border-radius: 18px;
    }

    /* 圆形改为圆角方块，更接近“App 图标” */
    #page-hall .popular-icon-circle {
        width: 56px;
        height: 56px;
        border-radius: 16px;
        margin-bottom: 8px;
        font-size: 0.95rem;
        letter-spacing: 0;
    }

    #page-hall .popular-name {
        width: 100%;
        text-align: center;
        font-size: 0.82rem;
        line-height: 1.2;
        margin-bottom: 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #page-hall .popular-info {
        font-size: 0.68rem;
        color: var(--text-muted);
        white-space: nowrap;
    }

    /* 移动端隐藏 hall 页标题行（按截图更紧凑） */
    #page-hall .home-section-header {
        display: none;
    }

    /* 移动端宫格不展示“最新开奖”块，避免把卡片撑高导致错位 */
    #page-hall .hall-item-draw {
        display: none;
    }

    /* hall.html：顶部分类 tabs 改为“横排 + 下划线” */

    #page-hall .filter-tabs {
        gap: 18px;
        padding: 0 4px 6px;
        margin-bottom: 16px;
        border-bottom: 1px solid var(--border-light);
    }

    #page-hall .filter-tab {
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 10px 2px;
        font-size: 0.9rem;
        font-weight: 700;
        color: var(--text-secondary);
        position: relative;
    }

    #page-hall .filter-tab.active {
        background: transparent;
        color: var(--danger);
        border-color: transparent;
    }

    #page-hall .filter-tab.active::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: -7px;
        height: 2px;
        background: var(--danger);
        border-radius: 2px;
    }



    .quick-portals { display: none; }

    .main-layout {
        margin-left: 0;
        width: 100%;
        margin-bottom: 0;
        padding-bottom: 0; /* 移除 main-layout 的底部留白，由 content-wrapper 统一控制 */
    }


    .top-nav { padding: 0 12px; height: 56px; }
    .user-panel { gap: 8px; }
    .balance-box { padding: 4px 8px; gap: 4px; }
    .balance-amount { font-size: 0.85rem; }
    .btn { padding: 6px 10px; font-size: 0.75rem; }

    .content-wrapper { padding: 12px; padding-bottom: calc(80px + env(safe-area-inset-bottom)); } /* 底部导航约 70px，留 80px 足够 */

    .carousel-container { margin-bottom: 16px; border-radius: 12px; }

    .carousel-slide { padding: 0 20px; }
    .slide-content h2 { font-size: 1.25rem; }
    .slide-content p { font-size: 0.75rem; margin-bottom: 12px; }

    .quick-portals { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 20px; }
    .portal-card { flex-direction: column; padding: 12px 8px; gap: 8px; text-align: center; border-radius: 12px; }
    .portal-icon { width: 40px; height: 40px; font-size: 1.2rem; }
    .portal-info h3 { font-size: 0.8rem; }
    .portal-info p { display: none; }
    .btn-sm { width: 100%; padding: 4px; font-size: 0.7rem; }

    .hall-grid { grid-template-columns: 1fr; gap: 12px; }
    .game-item { padding: 14px; }
    
    /* Mobile Lottery Numbers - Force Single Line & Scroll */
    .lottery-numbers, .draw-numbers {
        justify-content: flex-start !important;
        padding: 4px 2px;
    }

    .game-body-lottery { 
        padding: 10px; 
        min-height: 50px;
    }

    .game-name-text { font-size: 0.95rem; }
    
    .ball { width: 28px; height: 28px; font-size: 0.85rem; }
    .num { padding: 4px 8px; font-size: 0.8rem; }
    .dice { font-size: 1.8rem; }
    
    .asset-overview { grid-template-columns: 1fr; }
    .section-title { font-size: 1.25rem; }
}

/* Profile Page Enhanced Styles */
.profile-container {
    max-width: 600px;
    margin: 0 auto;
}

.profile-header-new {
    background: linear-gradient(135deg, #fff, #f8fafc);
    border: 1px solid var(--border-light);
    padding: 32px 24px;
    border-radius: 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.profile-header-new::after {
    content: '';
    position: absolute;
    top: -30%;
    right: -10%;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(197, 160, 33, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.profile-user-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.avatar-new {
    width: 80px;
    height: 80px;
    background: var(--accent-gold-light);
    border: 2px solid white;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-gold);
    box-shadow: 0 8px 16px rgba(197, 160, 33, 0.1);
}

.user-meta h3 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 4px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.user-meta p {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: 'Roboto Mono', monospace;
}

.balance-card-new {
    background: var(--text-primary);
    color: white;
    border-radius: 20px;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 12px 24px -8px rgba(30, 41, 59, 0.4);
}

.balance-card-new .label {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
    font-weight: 600;
    margin-bottom: 4px;
}

.balance-card-new .amount {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-gold);
    font-family: 'Roboto Mono', monospace;
}

.quick-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-item {
    background: var(--bg-white);
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-item .value {
    font-size: 1.1rem;
    font-weight: 800;
}

.action-menu {
    background: var(--bg-white);
    border-radius: 20px;
    border: 1px solid var(--border-light);
    overflow: hidden;
    margin-bottom: 24px;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text-primary);
}

.action-item:last-child { border-bottom: none; }
.action-item:hover { background: #f8fafc; }

.action-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: var(--text-secondary);
}

.action-item:hover .action-icon {
    background: var(--accent-gold-light);
    color: var(--accent-gold);
}

.action-info { flex: 1; }
.action-info h4 { font-size: 1rem; font-weight: 700; margin-bottom: 2px; }
.action-info p { font-size: 0.8rem; color: var(--text-muted); }

.action-arrow { color: var(--text-muted); opacity: 0.3; }

.menu-group-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 24px 0 12px 4px;
}

.vip-progress-container {
    margin-top: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 10px;
}

.vip-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    margin-bottom: 6px;
    color: rgba(255,255,255,0.7);
}

.vip-progress-bar {
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}

.vip-progress-fill {
    height: 100%;
    background: var(--accent-gold);
    box-shadow: 0 0 10px var(--accent-gold);
}

.edit-profile-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s;
}

.edit-profile-btn:hover {
    background: rgba(255,255,255,0.2);
}




