/* ============================================================
 * 谕烬志 - 全局响应式布局样式
 * 支持竖屏和横屏自适应
 * ============================================================ */

/* ============================================================
 * 基础响应式变量
 * ============================================================ */
:root {
    --container-max-width: 420px;
    --container-padding: 16px;
}

/* ============================================================
 * 横屏适配 - 手机横屏模式 (landscape)
 * ============================================================ */
@media screen and (orientation: landscape) and (max-height: 600px) {
    /* 容器适配 */
    .container {
        max-width: 100% !important;
        padding: 12px !important;
    }
    
    /* 头部样式优化 */
    .header {
        padding: 12px 16px !important;
    }
    
    .header-title {
        font-size: 16px !important;
    }
    
    /* 卡片布局优化 - 横屏时改为多列 */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
    }
    
    .stat-card {
        padding: 12px 8px !important;
    }
    
    .stat-icon {
        font-size: 20px !important;
        margin-bottom: 4px !important;
    }
    
    .stat-value {
        font-size: 14px !important;
    }
    
    .stat-label {
        font-size: 10px !important;
    }
    
    /* 分类算力 - 横屏时6列 */
    .category-grid {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 6px !important;
    }
    
    .category-card {
        padding: 8px 4px !important;
    }
    
    .category-icon {
        font-size: 20px !important;
    }
    
    .category-name {
        font-size: 10px !important;
    }
    
    .category-speed {
        font-size: 9px !important;
    }
    
    /* 商店 - 横屏时4列 */
    .shop-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
    }
    
    .shop-item {
        padding: 12px !important;
    }
    
    .shop-item-icon {
        font-size: 20px !important;
    }
    
    .shop-item-name {
        font-size: 12px !important;
    }
    
    .shop-item-desc {
        font-size: 10px !important;
        margin-bottom: 8px !important;
    }
    
    .shop-item-price {
        font-size: 12px !important;
    }
    
    .shop-buy-btn {
        padding: 4px 8px !important;
        font-size: 10px !important;
    }
    
    /* 道具背包 - 横屏时6列 */
    .inventory-grid {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 6px !important;
    }
    
    .inventory-item {
        padding: 8px !important;
    }
    
    .inventory-icon {
        font-size: 24px !important;
    }
    
    .inventory-name {
        font-size: 9px !important;
    }
    
    /* 用户信息卡片优化 */
    .user-card {
        padding: 16px !important;
        margin-bottom: 12px !important;
    }
    
    .user-header {
        margin-bottom: 12px !important;
    }
    
    .user-avatar {
        width: 48px !important;
        height: 48px !important;
        font-size: 20px !important;
    }
    
    .user-name {
        font-size: 16px !important;
    }
    
    /* 烬晶卡片优化 */
    .crystal-card {
        padding: 16px !important;
        margin-bottom: 12px !important;
    }
    
    .crystal-balance {
        font-size: 28px !important;
    }
    
    .crystal-pending {
        padding: 10px 12px !important;
        margin-top: 12px !important;
    }
    
    .action-buttons {
        margin-top: 12px !important;
    }
    
    .btn {
        padding: 10px !important;
        font-size: 13px !important;
    }
    
    /* 兑换区域优化 */
    .exchange-card {
        padding: 16px !important;
        margin-bottom: 12px !important;
    }
    
    .exchange-preview {
        padding: 12px !important;
        margin-bottom: 12px !important;
    }
    
    .preview-value {
        font-size: 24px !important;
    }
    
    .exchange-btn {
        padding: 12px !important;
        font-size: 14px !important;
    }
    
    /* 速度卡片优化 */
    .speed-card {
        padding: 16px !important;
        margin-bottom: 12px !important;
    }
    
    /* 章节标题优化 */
    .section-title {
        font-size: 14px !important;
        margin-bottom: 10px !important;
    }
    
    /* 信息卡片优化 */
    .info-card {
        padding: 12px !important;
        margin-bottom: 12px !important;
    }
    
    .info-item {
        font-size: 12px !important;
    }
}

/* ============================================================
 * 平板横屏适配 (大屏幕横屏)
 * ============================================================ */
@media screen and (orientation: landscape) and (min-width: 768px) {
    .container {
        max-width: 720px !important;
        margin: 0 auto !important;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    .category-grid {
        grid-template-columns: repeat(6, 1fr) !important;
    }
    
    .shop-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    .inventory-grid {
        grid-template-columns: repeat(6, 1fr) !important;
    }
}

/* ============================================================
 * 小屏幕手机竖屏优化
 * ============================================================ */
@media screen and (max-width: 375px) {
    .container {
        padding: 12px !important;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    
    .category-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
    }
    
    .shop-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    
    .inventory-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
    }
}

/* ============================================================
 * 横屏时底部导航优化
 * ============================================================ */
@media screen and (orientation: landscape) and (max-height: 600px) {
    .bottom-nav {
        padding: 6px 0 !important;
    }
    
    .bottom-nav-item {
        padding: 4px !important;
    }
    
    .bottom-nav-icon {
        width: 20px !important;
        height: 20px !important;
        margin-bottom: 2px !important;
    }
    
    .bottom-nav-text {
        font-size: 10px !important;
    }
}

/* ============================================================
 * 横屏时模态框优化
 * ============================================================ */
@media screen and (orientation: landscape) and (max-height: 600px) {
    .modal-content {
        max-width: 400px !important;
        padding: 20px !important;
    }
    
    .modal-title {
        font-size: 16px !important;
        margin-bottom: 12px !important;
    }
    
    .qrcode-box {
        width: 150px !important;
        height: 150px !important;
    }
}

/* ============================================================
 * 横屏时任务列表优化
 * ============================================================ */
@media screen and (orientation: landscape) and (max-height: 600px) {
    .task-item {
        padding: 12px !important;
    }
    
    .task-title {
        font-size: 14px !important;
    }
    
    .task-desc {
        font-size: 11px !important;
    }
    
    .task-reward {
        font-size: 13px !important;
    }
}

/* ============================================================
 * 横屏时邀请页面优化
 * ============================================================ */
@media screen and (orientation: landscape) and (max-height: 600px) {
    .invite-card {
        padding: 20px !important;
    }
    
    .invite-count {
        font-size: 36px !important;
    }
    
    .share-grid {
        grid-template-columns: repeat(8, 1fr) !important;
    }
    
    .share-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 20px !important;
    }
    
    .share-name {
        font-size: 10px !important;
    }
}

/* ============================================================
 * 通用横屏优化
 * ============================================================ */
@media screen and (orientation: landscape) {
    /* 减少底部留白 */
    body {
        padding-bottom: 70px !important;
    }
    
    /* 优化滚动体验 */
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }
    
    ::-webkit-scrollbar-track {
        background: transparent;
    }
    
    ::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 2px;
    }
}
