/* ========================================
   BLOODMONEY - 优化的通用样式文件
   ======================================== */

/* 全局样式 */
body {
    font-family: 'Roboto', sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    margin: 0;
    padding: 0;
    /* 性能优化 */
    will-change: auto;
    transform: translateZ(0);
    font-display: swap;
}

h1, h2 {
    font-family: 'Press Start 2P', cursive;
    font-display: swap;
}

.guide-text {
    max-width: 900px;
    margin: auto;
    line-height: 1.8;
    text-align: justify;
}

/* 游戏容器样式 */
.game-container {
    position: relative;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    will-change: auto;
    transform: translateZ(0);
    min-height: 700px;
    contain: layout;
    max-width: 100%;
}

.game-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #dc2626, #7c3aed, #059669, #dc2626);
    border-radius: 14px;
    z-index: -1;
    animation: borderGlow 3s ease-in-out infinite;
}

@keyframes borderGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* 游戏iframe样式 */
.game-responsive-width {
    max-width: 900px;
}

.game-responsive-width.size-large {
    max-width: 1200px;
}

.game-responsive-width.size-extra-large {
    max-width: 1400px;
}

.game-responsive-width.size-full {
    max-width: 95vw;
}

.game-iframe-wrapper {
    background: #000;
    border-radius: 8px;
    overflow: auto;
    position: relative;
    width: 100%;
    height: 600px;
    min-height: 400px;
    contain: layout;
    max-height: 80vh;
}

.game-iframe {
    width: 100%;
    height: 100%;
    min-width: 1000px;
    min-height: 700px;
    border: none;
    background: #000;
    display: block;
    contain: layout;
}

/* 侧边栏广告布局 */
.game-with-ads-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 25px;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    padding: 0 10px;
}

.sidebar-ad {
    width: 160px;
    min-height: 600px;
    position: sticky;
    top: 20px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 10px;
    z-index: 10;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.left-sidebar-ad {
    order: 1;
}

.game-container {
    order: 2;
    flex: 1;
    max-width: 900px;
    min-width: 0;
}

.right-sidebar-ad {
    order: 3;
}

/* 开发模式样式（仅在DEV_MODE=true时显示） */
.dev-mode .sidebar-ad {
    border: 2px dashed #666 !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.dev-mode .left-sidebar-ad::before {
    content: "Left Ad Zone\A160×600px" !important;
    white-space: pre !important;
    color: #888 !important;
    font-size: 12px !important;
    text-align: center !important;
    margin-bottom: 10px !important;
    padding: 5px !important;
    border-bottom: 1px dashed #444 !important;
    width: 100% !important;
}

.dev-mode .right-sidebar-ad::before {
    content: "Right Ad Zone\A160×600px" !important;
    white-space: pre !important;
    color: #888 !important;
    font-size: 12px !important;
    text-align: center !important;
    margin-bottom: 10px !important;
    padding: 5px !important;
    border-bottom: 1px dashed #444 !important;
    width: 100% !important;
}

.dev-mode .game-with-ads-container::before {
    content: "📐 Dev Mode: Sidebar ads visible (screen ≥ 1200px)" !important;
    position: absolute !important;
    top: -30px !important;
    left: 0 !important;
    right: 0 !important;
    text-align: center !important;
    color: #00ff00 !important;
    font-size: 11px !important;
    background: rgba(0, 0, 0, 0.8) !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    border: 1px dashed #00ff00 !important;
}

/* 响应式设计 */
@media (min-width: 1600px) {
    .game-responsive-width:not(.size-custom) {
        max-width: 1600px;
    }
    .game-iframe-wrapper {
        height: min(800px, 70vh);
        max-height: 80vh;
    }
    .game-iframe {
        min-width: 1200px;
        min-height: 700px;
    }
}

@media (min-width: 1920px) {
    .game-responsive-width:not(.size-custom) {
        max-width: 1800px;
    }
    .game-iframe-wrapper {
        height: min(900px, 65vh);
    }
    .game-iframe {
        min-width: 1400px;
        min-height: 750px;
    }
}

@media (min-width: 1400px) and (max-width: 1599px) {
    .game-responsive-width:not(.size-custom) {
        max-width: 1200px;
    }
    .game-iframe-wrapper {
        height: 700px;
    }
    .game-iframe {
        min-width: 1100px;
        min-height: 800px;
    }
}

/* 中等屏幕：保持广告但调整布局 */
@media (min-width: 1200px) and (max-width: 1399px) {
    .game-with-ads-container {
        gap: 15px;
        padding: 0 5px;
    }
    
    .sidebar-ad {
        width: 140px;
    }
    
    .game-container {
        max-width: 800px;
    }
}

/* 移动端广告样式 */
.mobile-game-ad {
    display: none;
    max-width: 100%;
    margin: 20px 0;
    padding: 10px;
    background: rgba(15, 23, 42, 0.3);
    border-radius: 8px;
    text-align: center;
}

/* 隐藏侧边栏广告的小屏幕 - 降低阈值增加显示机会 */
@media (max-width: 1023px) {
    .sidebar-ad {
        display: none;
    }
    
    /* 显示移动端广告 */
    .mobile-game-ad {
        display: block;
    }
    
    .game-with-ads-container {
        justify-content: center;
        flex-direction: column;
        align-items: center;
        padding: 0 15px;
    }
    
    .game-container {
        max-width: 100%;
        order: unset;
    }
    
    .dev-mode .game-with-ads-container::before {
        content: "📱 Dev Mode: Sidebar ads hidden (screen < 1024px)" !important;
        color: #ff9900 !important;
        border-color: #ff9900 !important;
    }
}

/* 平板设备优化显示 */
@media (min-width: 1024px) and (max-width: 1199px) {
    .game-with-ads-container {
        gap: 10px;
        padding: 0 5px;
    }
    
    .sidebar-ad {
        width: 120px;
        min-height: 400px;
    }
    
    .game-container {
        max-width: 700px;
    }
}

@media (max-width: 1200px) {
    .game-container {
        padding: 15px;
        margin: 0 10px;
    }
    .game-iframe-wrapper {
        height: 500px;
    }
    .game-iframe {
        min-width: 900px;
        min-height: 600px;
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 12px;
        margin: 0 5px;
    }
    .game-iframe-wrapper {
        height: 450px;
    }
    .game-iframe {
        min-width: 800px;
        min-height: 550px;
    }
}

@media (max-width: 480px) {
    .game-iframe-wrapper {
        height: 400px;
    }
    .game-iframe {
        min-width: 700px;
        min-height: 500px;
    }
    
    /* 移动端CLS优化 */
    body {
        overflow-x: hidden;
    }
    
    header {
        min-height: 180px;
    }
    
    nav {
        min-height: 80px;
    }
    
    .guide-text {
        min-height: 200px;
    }
}

/* 全屏模式 */
.game-iframe-wrapper.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    overflow: auto;
}

.game-iframe-wrapper.fullscreen .game-iframe {
    width: 100%;
    height: 100%;
    min-width: 100vw;
    min-height: 100vh;
    border-radius: 0;
}

/* 滚动条样式 */
.game-iframe-wrapper::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.game-iframe-wrapper::-webkit-scrollbar-track {
    background: #1e293b;
    border-radius: 6px;
}

.game-iframe-wrapper::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 6px;
    border: 2px solid #1e293b;
}

.game-iframe-wrapper::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}
