/* ========================================
   统一导航栏 - 德国极简设计
   最小化高度，响应式适配
   ======================================== */

:root {
    --header-bg: #1a1d20;
    --header-border: #2d3236;
    --brand-color: #0066cc;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --accent-color: #0066cc;
    --success-color: #28a745;
    --header-height: 48px;
    --header-height-mobile: 44px;
}

/* ===== 统一Header容器 ===== */
.unified-header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    position: sticky;
    top: 0;
    z-index: 1040;
    height: var(--header-height);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.unified-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 12px;
    height: 100%;
    gap: 16px;
}

/* ===== Logo & Brand ===== */
.brand-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-color), #004c99);
    border-radius: 6px;
    color: white;
    text-decoration: none;
    transition: transform 0.2s;
}

.brand-logo:hover {
    transform: scale(1.05);
}

.brand-logo i {
    font-size: 18px;
}

.brand-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    white-space: nowrap;
    margin: 0;
    padding: 0;
    line-height: 1;
}

/* ===== 游戏导航 (桌面) ===== */
.games-nav {
    display: flex;
    gap: 4px;
    flex: 1;
    max-width: 800px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.games-nav::-webkit-scrollbar {
    display: none;
}

.game-link {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 4px;
    white-space: nowrap;
    transition: all 0.2s;
    position: relative;
}

.game-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.game-link.active {
    color: var(--text-primary);
    background: var(--accent-color);
}

.game-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 12px;
    right: 12px;
    height: 2px;
    background: var(--text-primary);
    display: none;
}

/* ===== 移动端游戏选择器 ===== */
.mobile-game-selector {
    flex: 1;
    max-width: 200px;
}

.game-selector-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 6px 12px;
    background: var(--accent-color);
    border: none;
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.game-selector-btn:hover {
    background: #0052a3;
}

.game-selector-btn i {
    font-size: 12px;
    margin-left: 8px;
}

.mobile-game-selector .dropdown-menu {
    background: var(--header-bg);
    border: 1px solid var(--header-border);
    border-radius: 6px;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.mobile-game-selector .dropdown-item {
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 14px;
    transition: all 0.2s;
}

.mobile-game-selector .dropdown-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* ===== 游戏控制区 ===== */
.game-controls-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* 模式切换 */
.mode-toggle-compact {
    display: flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 2px;
}

.mode-btn-compact {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 28px;
}

.mode-btn-compact:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.mode-btn-compact.active {
    color: var(--text-primary);
    background: var(--accent-color);
}

/* 统计信息 */
.stats-compact {
    display: flex;
    gap: 12px;
    padding: 0 8px;
    border-left: 1px solid var(--header-border);
}

.stat-compact {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.stat-compact i {
    font-size: 14px;
    color: var(--text-muted);
}

.stat-label-compact {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
}

.stat-value-compact {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 32px;
}

/* 操作按钮 */
.action-btns-compact {
    display: flex;
    gap: 4px;
    padding-left: 8px;
    border-left: 1px solid var(--header-border);
}

.action-btn-compact {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.action-btn-compact:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.action-btn-compact:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-btn-compact i {
    font-size: 14px;
    flex-shrink: 0;
}

.btn-text-compact {
    font-size: 12px;
    font-weight: 500;
    color: inherit;
}

.action-btn-compact.btn-primary-compact {
    background: var(--success-color);
    color: white;
}

.action-btn-compact.btn-primary-compact:hover:not(:disabled) {
    background: #218838;
}

/* 额外按钮组 */
.extra-btns-compact {
    display: flex;
    gap: 4px;
    padding-left: 8px;
    border-left: 1px solid var(--header-border);
}

/* 设置和声音按钮 */
.settings-btn-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-btn-compact:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* 声音按钮激活状态 */
#soundToggleBtn.sound-off i::before {
    content: "\f5d9"; /* bi-volume-mute-fill */
}

#soundToggleBtn.sound-off {
    color: #dc3545;
}

/* ===== 响应式设计 ===== */

/* 平板 (768px - 1024px) */
@media screen and (max-width: 1024px) {
    .games-nav {
        max-width: 500px;
    }
    
    .game-link {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* 手机横屏 - 适配所有手机包括iPhone (横屏且高度<700px) */
@media screen and (orientation: landscape) and (max-height: 700px) {
    :root {
        --header-height: 0px;
    }
    
    /* 隐藏header以节省屏幕空间 */
    .unified-header {
        display: none;
    }
    
    .unified-header-container {
        padding: 0 8px;
        gap: 8px;
    }
    
    .brand-logo {
        width: 28px;
        height: 28px;
    }
    
    .brand-logo i {
        font-size: 16px;
    }
    
    .brand-name {
        font-size: 14px;
    }
    
    .game-selector-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .mode-btn-compact {
        padding: 3px 8px;
        font-size: 11px;
    }
    
    .stat-compact {
        font-size: 11px;
        gap: 3px;
    }
    
    .stat-compact i {
        font-size: 12px;
    }
    
    .stat-label-compact {
        font-size: 10px;
    }
    
    .stat-value-compact {
        min-width: 28px;
        font-size: 11px;
    }
    
    .action-btn-compact {
        padding: 4px 6px;
        font-size: 12px;
    }
    
    .btn-text-compact {
        font-size: 10px;
    }
    
    .settings-btn-compact {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .stats-compact {
        gap: 8px;
        padding: 0 6px;
    }
    
    .action-btns-compact {
        gap: 3px;
        padding-left: 6px;
    }
    
    .extra-btns-compact {
        gap: 3px;
        padding-left: 6px;
    }
}

/* 手机竖屏 (< 768px portrait) */
@media screen and (max-width: 767px) and (orientation: portrait) {
    :root {
        --header-height: 44px;
    }
    
    .unified-header-container {
        padding: 0 8px;
        gap: 8px;
    }
    
    .brand-logo {
        width: 30px;
        height: 30px;
    }
    
    .brand-logo i {
        font-size: 16px;
    }
    
    .mobile-game-selector {
        max-width: 140px;
    }
    
    .game-selector-btn {
        padding: 5px 10px;
        font-size: 13px;
    }
    
    .stats-compact {
        gap: 10px;
    }
    
    .stat-label-compact {
        display: none; /* 竖屏隐藏标签，只显示图标和数值 */
    }
    
    .action-btns-compact {
        gap: 4px;
    }
    
    .extra-btns-compact {
        gap: 4px;
    }
}

/* 极小屏幕 (< 480px) */
@media screen and (max-width: 480px) {
    .mobile-game-selector {
        max-width: 120px;
    }
    
    .game-selector-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .mode-toggle-compact {
        display: none !important;
    }
    
    .stats-compact {
        gap: 8px;
        padding: 0 4px;
    }
    
    .stat-compact {
        font-size: 12px;
    }
    
    .stat-label-compact {
        display: none !important;
    }
    
    .btn-text-compact {
        display: none !important;
    }
    
    .action-btns-compact {
        gap: 2px;
        padding-left: 4px;
    }
    
    .extra-btns-compact {
        gap: 2px;
        padding-left: 4px;
    }
}

/* 极小屏幕横屏保留作为备用 */
@media screen and (orientation: landscape) and (max-height: 500px) {
    :root {
        --header-height: 0px;
    }
    
    /* 隐藏header以节省屏幕空间 */
    .unified-header {
        display: none;
    }
    
    .brand-logo {
        width: 26px;
        height: 26px;
    }
    
    .brand-logo i {
        font-size: 14px;
    }
    
    .game-selector-btn {
        padding: 3px 6px;
        font-size: 11px;
    }
    
    .mode-btn-compact {
        padding: 2px 6px;
        font-size: 10px;
        min-width: 24px;
    }
    
    .stat-compact {
        font-size: 10px;
    }
    
    .stat-compact i {
        font-size: 11px;
    }
    
    .stat-label-compact {
        font-size: 9px;
    }
    
    .stat-value-compact {
        min-width: 24px;
        font-size: 10px;
    }
    
    .action-btn-compact {
        padding: 3px 5px;
        font-size: 11px;
    }
    
    .btn-text-compact {
        font-size: 9px;
    }
    
    .settings-btn-compact {
        width: 26px;
        height: 26px;
        font-size: 13px;
    }
}

/* 调整游戏区域的padding以适应新的header高度 */
.game-board {
    min-height: calc(100vh - var(--header-height));
}

@media screen and (max-width: 767px) and (orientation: portrait) {
    .game-board {
        min-height: calc(100vh - var(--header-height-mobile));
    }
}

/* 确保dropdown在移动端正确显示 */
@media screen and (max-width: 767px) {
    .mobile-game-selector .dropdown-menu {
        max-height: 60vh;
        overflow-y: auto;
    }
}
