/* 搜索头部 */
.search-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

/* 功能切换区域 */
.feature-tabs {
    z-index: 99;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

/* 页签样式 */
.tabs-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.tab {
    padding: 8px 16px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.tab.active {
    background: #FFCC00;
    border-color: #FF6B00;
    color: #333;
    box-shadow: 0 3px 10px rgba(255, 107, 0, 0.3);
}

/* 搜索容器 */
.search-container {
    display: flex;
    gap: 12px;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

.search-input {
    flex: 1;
    padding: 12px 18px;
    border: 3px solid #FFCC00;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    background: white;
    min-width: 0;
}

.search-input:focus {
    border-color: #FF6B00;
    box-shadow: 0 0 15px rgba(255, 107, 0, 0.3);
}

/* 搜索按钮也统一圆角 */
.search-button {
    padding: 12px 25px;
    background: #FFCC00;
    border: none;
    border-radius: 20px; /* 统一圆角 */
    color: #333;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.search-button:hover {
    background: #FFDD44;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* 确保统计按钮也在统一容器中 */
.stats-button {
    /* 移除原有的固定定位 */
    position: static;
    /* 其他样式保持不变 */
    padding: 12px 24px;
    background: #4CAF50;
    border: none;
    border-radius: 20px;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    min-width: 100px;
    text-align: center;
}

.stats-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.stats-button.active {
    background: #FF6B00;
}

/* 导入导出按钮样式 - 也统一尺寸 */
.import-export-buttons {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px; /* 统一间距 */
    z-index: 1000;
}

.import-button, .export-button {
    padding: 12px 20px; /* 调整内边距与其他按钮协调 */
    background: #2196F3;
    border: none;
    border-radius: 20px; /* 统一圆角 */
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    min-width: 100px; /* 统一最小宽度 */
    text-align: center;
}

.import-button:hover, .export-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.export-button {
    background: #FF9800;
}

/* 卡牌网格 */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 10px; /* 统一的水平和垂直间距 */
    margin-top: 20px;
}

.card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
    aspect-ratio: 63/88;
    position: relative;
    height: 119px;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.card:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.3);
}

.stat-mode .card:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 15px rgba(76, 175, 80, 0.4);
}

/* 移动端统计模式的视觉反馈 */
.stat-mode .card:active {
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #f0f0f0;
    background-image: linear-gradient(45deg, #e6e6e6 25%, transparent 25%, transparent 75%, #e6e6e6 75%, #e6e6e6),
                      linear-gradient(45deg, #e6e6e6 25%, transparent 25%, transparent 75%, #e6e6e6 75%, #e6e6e6);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.card-img.loaded {
    opacity: 1;
    background: none;
}

.card-img.error {
    opacity: 1;
    background: linear-gradient(45deg, #ffcc00, #ffdd44);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 0.8rem;
    text-align: center;
    padding: 10px;
}

.card-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    text-shadow: 
        -1px -1px 0 #000,  
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
    z-index: 2;
}

.card-quantity {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 3;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

/* 模态框内容样式 */
.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-img-container {
    width: 315px;
    height: 440px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-bottom: 10px;
    overflow: hidden;
    position: relative;
    touch-action: pan-y;
}

.modal-img-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
}

.modal-img {
    width: 315px;
    height: 440px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(255, 204, 0, 0.4);
    flex-shrink: 0;
    transition: transform 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
}

.modal-img.current {
    z-index: 2;
}

.modal-img.next {
    z-index: 1;
    transform: translateX(100%);
}

.modal-img.prev {
    z-index: 1;
    transform: translateX(-100%);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    color: white;
    background: rgba(0, 0, 0, 0.4);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.3s ease;
    z-index: 1001;
}

.nav-arrow:hover {
    background: rgba(0, 0, 0, 0.7);
}

.arrow-left {
    left: 20px;
}

.arrow-right {
    right: 20px;
}

.card-info {
    color: white;
    text-align: center;
    position: relative;
    z-index: 2;
    width: 100%;
    margin-top: 10px;
}

.card-name {
    font-size: 1.8rem;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    transition: none !important;
}

.no-results {
    text-align: center;
    color: white;
    font-size: 1.2rem;
    margin-top: 50px;
    padding: 20px;
}

/* 响应式设计 - 所有端统一调整 */
@media (max-width: 768px) {
    /* 平板端统一调整 */
    .deck-init-button-container {
        bottom: 70px;
        left: 15px;
        gap: 6px;
    }
    
    .deck-button {
        padding: 10px 20px;
        font-size: 0.95rem;
        min-width: 90px;
        border-radius: 18px;
    }
    
    .stats-button {
        bottom: 15px;
        left: 15px;
        padding: 10px 20px;
        font-size: 0.95rem;
        min-width: 90px;
        border-radius: 18px;
    }
    
    .deck-button-container {
        bottom: 15px;
        left: 15px;
        gap: 6px;
    }
    
    .deck-search-button,
    .deck-edit-button,
    .deck-add-button,
    .deck-save-button,
    .deck-complete-button,
    .deck-save-in-add-button {
        padding: 10px 20px;
        font-size: 0.95rem;
        min-width: 90px;
        border-radius: 18px;
    }
    
    .import-export-buttons {
        bottom: 15px;
        right: 15px;
        gap: 6px;
    }
    
    .import-button, .export-button {
        padding: 10px 20px;
        font-size: 0.95rem;
        min-width: 90px;
        border-radius: 18px;
    }

    .search-button {
        padding: 10px 20px;
        font-size: 0.9rem;
        border-radius: 18px;
    }

    /* 移动端卡牌网格 - 每行4张，统一间距 */
    .card-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px; /* 保持统一的水平和垂直间距 */
    }
    
    .card {
        height: 110px; /* 稍微缩小卡图尺寸 */
    }
}

@media (max-width: 480px) {
    /* 手机端统一调整 */
    .deck-init-button-container {
        bottom: 65px;
        left: 10px;
        gap: 5px;
    }
    
    .deck-button {
        padding: 8px 16px;
        font-size: 0.9rem;
        min-width: 80px;
        border-radius: 16px;
    }
    
    .stats-button {
        bottom: 10px;
        left: 10px;
        padding: 8px 16px;
        font-size: 0.9rem;
        min-width: 80px;
        border-radius: 16px;
    }
    
    .deck-button-container {
        bottom: 10px;
        left: 10px;
        gap: 5px;
    }
    
    .deck-search-button,
    .deck-edit-button,
    .deck-add-button,
    .deck-save-button,
    .deck-complete-button,
    .deck-save-in-add-button {
        padding: 8px 16px;
        font-size: 0.9rem;
        min-width: 80px;
        border-radius: 16px;
    }
    
    .import-export-buttons {
        bottom: 10px;
        right: 10px;
        gap: 5px;
    }
    
    .import-button, .export-button {
        padding: 8px 16px;
        font-size: 0.9rem;
        min-width: 80px;
        border-radius: 16px;
    }
        
    .search-button {
        padding: 8px 16px;
        font-size: 0.85rem;
        border-radius: 16px;
    }

    /* 手机端卡牌网格优化 */
    .card-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px; /* 稍微减小间距 */
    }
    
    .card {
        height: 105px; /* 进一步缩小卡图尺寸 */
    }
}

@media (min-width: 769px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
        gap: 15px;
    }
    
    .card {
        height: 176px;
    }

    .card-badge {
        font-size: 1.05rem;
        width: 25px;
        height: 25px;
    }
    
    .card-quantity {
        width: 37.5px;
        height: 37.5px;
        font-size: 1rem;
    }
}

/* 移除独立的卡组按钮容器 */
.deck-init-button-container {
    display: none; /* 隐藏独立的容器 */
}

/* 统一的按钮基础样式 */
.deck-button, .stats-button {
    padding: 12px 24px;
    border: none;
    border-radius: 20px;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    min-width: 100px;
    text-align: center;
}

.deck-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    background: #8E24AA;
}

/* 确保卡组页签容器布局正确 */
.deck-tabs-container {
    display: flex;
    flex-wrap: nowrap; /* 改为不换行 */
    gap: 10px;
    padding: 10px;
    max-height: 150px; /* 保持适当高度 */
    overflow-x: auto; /* 横向滚动 */
    overflow-y: hidden; /* 隐藏纵向滚动 */
    align-items: flex-start;
    scrollbar-width: thin; /* Firefox 滚动条样式 */
    -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
}

/* Webkit 滚动条样式 */
.deck-tabs-container::-webkit-scrollbar {
    height: 6px;
}

.deck-tabs-container::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.deck-tabs-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.deck-tabs-container::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* 卡组页签样式（确保一致性） */
.deck-tab {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    width: auto;
    height: auto;
    min-width: 200px; /* 保持最小宽度 */
    flex-shrink: 0; /* 防止收缩 */
    box-sizing: border-box;
}

.deck-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.deck-tab.active {
    border-color: #FF9800;
    background: #fff8e1;
}

/* 修复卡组页签在编辑模式下的样式 */
.deck-tab.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.deck-tab.disabled:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 卡组封面样式优化 */
/* 卡组封面样式（确保一致性） */
.deck-cover {
    width: 80px;
    height: 112px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    flex-shrink: 0;
    margin-right: 10px;
}

/* 封面图片样式 - 确保完整显示 */
.deck-cover img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* 关键：保持完整比例，不裁剪 */
    object-position: center;
    border-radius: 7px;
}

/* 无封面时的样式 */
.deck-cover.no-cover {
    font-size: 0.7rem;
    color: #999;
    text-align: center;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: break-all;
}

.deck-tab.active .deck-cover {
    border: 2px solid #FF9800;
}

.deck-tab.active .deck-cover:hover {
    background: #fff8e1;
}

/* 编辑模式下当前卡组封面可点击样式 */
.deck-tab.active .deck-cover.editable {
    border: 2px dashed #FF9800 !important;
    cursor: pointer;
}

.deck-tab.active .deck-cover.editable:hover {
    border-color: #FF5722 !important;
    background: rgba(255, 152, 0, 0.1);
}

/* 卡组信息样式（确保一致性） */
.deck-info {
    flex: 1;
    min-width: 0;
}

.deck-name {
    font-weight: bold;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 可点击的卡组名称样式 */
.deck-name.editable {
    cursor: pointer;
    border-bottom: 1px dashed #FF9800;
    padding: 2px;
    transition: all 0.2s ease;
}

.deck-name.editable:hover {
    background: rgba(255, 152, 0, 0.1);
    border-bottom-color: #FF5722;
}

/* 名称输入框样式 */
.deck-name-input {
    width: 100%;
    border: 1px solid #FF9800 !important;
    border-radius: 3px;
    padding: 2px 5px;
    font-size: 0.9rem;
    background: white;
    color: #333;
    outline: none;
}

.deck-count {
    font-size: 0.8rem;
    color: #666;
}

/* 新建卡组按钮样式 - 横向滚动布局 */
.deck-tab-add {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin: 0; /* 移除上下边距 */
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    width: 80px;
    height: 134px;
    flex-shrink: 0; /* 防止收缩 */
    text-decoration: none;
    box-sizing: border-box;
}

.deck-tab-add:hover {
    border-color: #FF9800; /* 悬停时与卡组页签相同的边框颜色 */
    background: #fff8e1; /* 悬停时与卡组页签相同的背景 */
    transform: translateY(-2px); /* 与卡组页签相同的悬停效果 */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* 与卡组页签相同的阴影 */
}

/* 直接在按钮上显示加号 */
.deck-tab-add::before {
    content: '+';
    font-size: 3rem;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.deck-tab-add:hover::before {
    color: #FF9800; /* 悬停时改变加号颜色 */
}

/* 移除内部的加号容器，直接在按钮上显示加号 */
.deck-tab-add .add-icon {
    display: none; /* 隐藏原来的加号容器 */
}

.deck-tab-add:hover .add-icon {
    border-color: #FF9800; /* 悬停时与封面边框一致 */
    color: #FF9800; /* 悬停时与封面颜色一致 */
    background: rgba(255, 152, 0, 0.1); /* 悬停时轻微背景色 */
}

/* 完全移除信息区域 */
.deck-tab-add .add-info {
    display: none;
}

/* 移除新增按钮内部的文本 */
.deck-tab-add .add-text {
    display: none;
}

.deck-tab-add:hover .add-text {
    color: #FF9800;
}

/* 统一的按钮容器 */
.deck-button-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

/* 卡组功能按钮通用样式 - 完全统一尺寸 */
.deck-search-button,
.deck-edit-button,
.deck-add-button,
.deck-save-button,
.deck-complete-button,
.deck-save-in-add-button {
    padding: 12px 24px; /* 完全统一内边距 */
    border: none;
    border-radius: 20px; /* 完全统一圆角 */
    color: white;
    font-weight: bold;
    font-size: 1rem; /* 完全统一字体大小 */
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    min-width: 100px; /* 完全统一最小宽度 */
    text-align: center;
}

.deck-search-button:hover,
.deck-edit-button:hover,
.deck-add-button:hover,
.deck-save-button:hover,
.deck-complete-button:hover,
.deck-save-in-add-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* 具体按钮颜色 */
.deck-search-button {
    background: #2196F3;
}

.deck-edit-button {
    background: #FF9800;
}

.deck-add-button {
    background: #4CAF50;
}

.deck-save-button {
    background: #FF6B00;
}

.deck-complete-button {
    background: #4CAF50;
}

.deck-save-in-add-button {
    background: #FF6B00;
}

/* 编辑模式下的特殊样式 */
.deck-edit-mode .card {
    cursor: pointer;
}

.deck-edit-mode .card:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 15px rgba(255, 107, 0, 0.4);
}

.deck-add-mode .card:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 15px rgba(76, 175, 80, 0.4);
}

/* 选择封面提示 */
/* 封面选择提示样式 */
.cover-selection-hint {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px 30px;
    border-radius: 10px;
    z-index: 1001;
    font-size: 1.2rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: pulse-hint 2s infinite;
}

@keyframes pulse-hint {
    0% { box-shadow: 0 4px 20px rgba(255, 152, 0, 0.5); }
    50% { box-shadow: 0 4px 30px rgba(255, 152, 0, 0.8); }
    100% { box-shadow: 0 4px 20px rgba(255, 152, 0, 0.5); }
}

/* 封面选择模式下的卡牌悬停效果 */
.cover-selection-mode .card:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.8);
    cursor: pointer;
}

/* 可编辑的封面样式 */
.deck-cover.editable {
    border: 2px dashed #FF9800 !important;
    cursor: pointer;
    transition: all 0.3s ease;
}

.deck-cover.editable:hover {
    border-color: #FF5722 !important;
    background: rgba(255, 152, 0, 0.1);
    transform: scale(1.02);
}

/* 响应式设计 - 移动端优化 */
@media (max-width: 768px) {
    /* 卡牌查看界面的按钮 */
    .deck-init-button-container {
        bottom: 70px; /* 在移动端更靠近统计按钮 */
        left: 15px;
        gap: 6px; /* 移动端更小的间距 */
    }
    
    .deck-button {
        padding: 10px 20px;
        font-size: 0.95rem;
        min-width: 90px;
        border-radius: 18px;
    }
    
    .stats-button {
        bottom: 15px;
        left: 15px;
        padding: 10px 20px;
        font-size: 0.95rem;
        min-width: 90px;
        border-radius: 18px;
    }
    
    /* 卡组界面的按钮 */
    .deck-button-container {
        bottom: 15px;
        left: 15px;
        gap: 6px; /* 移动端更小的间距 */
    }
    
    .deck-search-button,
    .deck-edit-button,
    .deck-add-button,
    .deck-save-button,
    .deck-complete-button,
    .deck-save-in-add-button {
        padding: 10px 20px;
        font-size: 0.95rem;
        min-width: 90px;
        border-radius: 18px;
    }
}

/* 大屏幕设备（桌面端） */
@media (min-width: 1025px) {
    .deck-init-button-container {
        bottom: 80px; /* 桌面端也使用调整后的位置 */
        gap: 8px; /* 桌面端也使用紧凑间距 */
    }
    
    .deck-button-container {
        gap: 8px; /* 桌面端也使用紧凑间距 */
    }
    
    .import-export-buttons {
        gap: 8px; /* 桌面端也使用紧凑间距 */
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* 操作反馈样式 */
.deck-operation-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 1001;
    font-size: 1rem;
    animation: fadeInOut 1s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* === 统一的按钮样式 === */

/* 统一的全局按钮容器 - 左下角 */
.global-button-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

/* 统一的按钮基础样式 */
.global-button {
    padding: 12px 24px;
    border: none;
    border-radius: 20px;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    min-width: 100px;
    text-align: center;
}

.global-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* 具体按钮颜色 */
.deck-button { background: #9C27B0; }
.stats-button { background: #4CAF50; }
.stats-button.active { background: #FF6B00; }
.deck-search-button { background: #2196F3; }
.deck-edit-button { background: #FF9800; }
.deck-add-button { background: #4CAF50; }
.deck-save-button { background: #FF6B00; }
.deck-complete-button { background: #4CAF50; }
.import-button { background: #2196F3; }
.export-button { background: #FF9800; }

/* 导入导出按钮容器 - 右下角 */
.import-export-buttons {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.import-button, .export-button {
    padding: 12px 24px;
    border: none;
    border-radius: 20px;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    min-width: 100px;
    text-align: center;
}

.import-button { background: #2196F3; }
.export-button { background: #FF9800; }

.import-button:hover, .export-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* 隐藏所有旧的按钮容器 */
.deck-init-button-container,
.deck-button-container {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .global-button-container,
    .import-export-buttons {
        bottom: 15px;
        gap: 6px;
    }
    
    .global-button-container {
        left: 15px;
    }
    
    .import-export-buttons {
        right: 15px;
    }
    
    .global-button,
    .import-button, 
    .export-button {
        padding: 10px 20px;
        font-size: 0.95rem;
        min-width: 90px;
        border-radius: 18px;
    }
}

@media (max-width: 480px) {
    .global-button-container,
    .import-export-buttons {
        bottom: 10px;
        gap: 5px;
    }
    
    .global-button-container {
        left: 10px;
    }
    
    .import-export-buttons {
        right: 10px;
    }
    
    .global-button,
    .import-button, 
    .export-button {
        padding: 8px 16px;
        font-size: 0.9rem;
        min-width: 80px;
        border-radius: 16px;
    }
}

/* 删除按钮在横向布局中的定位调整 */
.deck-delete-button {
    position: absolute;
    top: -6px; /* 稍微调整位置 */
    right: -6px;
    width: 22px;
    height: 22px;
    background: #ff4444;
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.deck-delete-button:hover {
    background: #ff0000;
    transform: scale(1.1);
}

/* 编辑模式下显示删除按钮 */
.deck-edit-mode .deck-tab.active .deck-delete-button {
    display: flex;
}

/* 确认删除模态框 */
.delete-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.delete-confirm-modal.active {
    opacity: 1;
    pointer-events: all;
}

.delete-confirm-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.delete-confirm-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
}

.delete-confirm-message {
    font-size: 1.1rem;
    margin-bottom: 25px;
    color: #666;
    line-height: 1.5;
}

.delete-confirm-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.delete-confirm-button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.delete-confirm-cancel {
    background: #6c757d;
    color: white;
}

.delete-confirm-cancel:hover {
    background: #5a6268;
}

.delete-confirm-delete {
    background: #dc3545;
    color: white;
}

.delete-confirm-delete:hover {
    background: #c82333;
}

/* 响应式页签布局 */
@media (max-width: 768px) {
    .tabs-container {
        gap: 6px;
        justify-content: space-between;
    }
    
    .tab {
        padding: 10px 12px; /* 调整内边距 */
        font-size: 0.8rem; /* 缩小字号 */
        flex: 1;
        min-width: calc(25% - 12px);
        text-align: center;
        white-space: nowrap;
        overflow: visible; /* 改为可见，不隐藏溢出 */
        text-overflow: clip; /* 改为裁剪而不是省略号 */
    }
}

@media (max-width: 480px) {
    .tabs-container {
        gap: 5px;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: auto auto;
    }
    
    .tab {
        padding: 8px 6px; /* 减小内边距 */
        font-size: 0.75rem; /* 进一步缩小字号 */
        min-width: auto;
        flex: none;
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
    }
    
    /* 确保第二行的3个页签居中显示 */
    .tab:nth-child(n+5) {
        grid-column: span 1;
    }
    
    /* 调整特定页签的显示 */
    .tab[data-tab="宝可梦"] { grid-column: 1; grid-row: 1; }
    .tab[data-tab="支援者"] { grid-column: 2; grid-row: 1; }
    .tab[data-tab="物品"] { grid-column: 3; grid-row: 1; }
    .tab[data-tab="宝可梦道具"] { grid-column: 4; grid-row: 1; }
    .tab[data-tab="竞技场"] { grid-column: 1; grid-row: 2; }
    .tab[data-tab="基本能量"] { grid-column: 2; grid-row: 2; }
    .tab[data-tab="特殊能量"] { grid-column: 3; grid-row: 2; }
    
    /* 为字数较多的页签特别调整 */
    .tab[data-tab="宝可梦道具"] {
        font-size: 0.7rem; /* 4个字进一步缩小 */
        padding: 8px 4px; /* 减小内边距 */
    }
}

/* 超小屏优化 */
@media (max-width: 360px) {
    .tabs-container {
        gap: 4px;
    }
    
    .tab {
        padding: 6px 4px;
        font-size: 0.7rem; /* 超小屏使用更小字号 */
    }
    
    .tab[data-tab="宝可梦道具"] {
        font-size: 0.65rem; /* 4个字在超小屏进一步缩小 */
    }

    .card-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px; /* 超小屏减小间距 */
    }
    
    .card {
        height: 100px; /* 超小屏进一步缩小 */
    }
}

/* 卡牌数量显示移动端优化 */
@media (max-width: 480px) {
    .card-quantity {
        width: 25px;
        height: 25px;
        font-size: 0.7rem;
    }
}

@media (max-width: 360px) {
    .card-quantity {
        width: 22px;
        height: 22px;
        font-size: 0.65rem;
    }
}

/* 移动端优化 */
@media (max-width: 768px) {
    .deck-tabs-container {
        padding: 8px;
        gap: 8px;
        max-height: 140px; /* 移动端稍微降低高度 */
    }
    
    .deck-tab {
        min-width: 180px; /* 移动端稍微减小宽度 */
        padding: 8px;
    }
    
    .deck-cover {
        width: 70px; /* 稍微调整封面大小 */
        height: 98px;
    }
    
    .deck-tab-add {
        width: 70px;
        height: 118px;
    }
}

@media (max-width: 480px) {
    .deck-tabs-container {
        padding: 6px;
        gap: 6px;
        max-height: 130px; /* 手机端进一步降低高度 */
    }
    
    .deck-tab {
        min-width: 160px; /* 手机端进一步减小宽度 */
        padding: 6px;
    }
    
    .deck-cover {
        width: 60px;
        height: 84px;
        margin-right: 8px; /* 调整封面与信息的间距 */
    }
    
    .deck-info {
        min-width: 0; /* 允许信息区域收缩 */
    }
    
    .deck-name {
        font-size: 0.9rem; /* 稍微缩小名称字号 */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .deck-count {
        font-size: 0.75rem; /* 稍微缩小计数字号 */
    }
    
    .deck-tab-add {
        width: 60px;
        height: 106px;
    }
    
    /* 直接在按钮上显示加号 */
    .deck-tab-add::before {
        font-size: 2.5rem; /* 移动端调整加号大小 */
    }
}

/* 超小屏优化 */
@media (max-width: 360px) {
    .deck-tabs-container {
        padding: 5px;
        gap: 5px;
        max-height: 120px;
    }
    
    .deck-tab {
        min-width: 150px;
        padding: 5px;
    }
    
    .deck-cover {
        width: 55px;
        height: 77px;
        margin-right: 6px;
    }
    
    .deck-name {
        font-size: 0.85rem;
    }
    
    .deck-count {
        font-size: 0.7rem;
    }
    
    .deck-tab-add {
        width: 55px;
        height: 99px;
    }
    
    .deck-tab-add::before {
        font-size: 2.2rem;
    }
}