/* ================================================================================
   deck_builder.css - 卡组构筑页面样式
   说明：从 templates/deck_builder.html 迁移而来的页面级样式
   创建：Phase 2 收尾
   ================================================================================ */

/* ===== 页面基础 ===== */
body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* 覆盖 base.css 的 main-content 限制，让 deck_builder 使用全宽 */
.main-content {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}

/* deck_builder 页面唯一主限宽层 */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    margin-top: 10px;
}

/* ===== 卡组构筑器主容器 ===== */
.builder-container {
    background: #0f172a;
    border-radius: 20px;
    overflow: visible;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    border: 1px solid #2d3748;
}

/* ===== 头部 ===== */
.builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: linear-gradient(to right, #1a2332, #2a3441);
    border-bottom: 2px solid #4a5568;
    position: relative;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 30px;
}

.header-left h2 {
    color: white;
    font-size: 20px;
    margin: 0;
}

.mobile-builder-back,
.mobile-builder-title,
.mobile-card-pool-title,
.mobile-pool-heading,
.mobile-zone-strip,
.deck-actions-label-mobile,
.save-deck-label-mobile,
.mobile-only-stat {
    display: none;
}

/* ===== 卡组统计徽章 ===== */
.deck-stats-badge {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0,0,0,0.3);
    padding: 8px 20px;
    border-radius: 40px;
    border: 1px solid #4a5568;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.stat-label {
    color: #94a3b8;
    font-weight: 500;
}

.stat-value {
    color: white;
    font-weight: bold;
}

.stat-value.warning {
    color: #ef4444;
}

.stat-max {
    color: #64748b;
    font-size: 12px;
}

.stat-divider {
    width: 1px;
    height: 20px;
    background: #4a5568;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== 按钮样式 ===== */
.deck-btn {
    padding: 8px 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.deck-btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
}

/* 按钮变体 */
.btn-primary { background: #667eea; }
.btn-primary:hover { background: #764ba2; }

.btn-danger { background: #ef4444; }
.btn-danger:hover { background: #dc2626; }

.btn-success { background: #10b981; }
.btn-success:hover { background: #059669; }

.btn-warning { background: #f59e0b; }
.btn-warning:hover { background: #d97706; }

.btn-info { background: #3b82f6; }
.btn-info:hover { background: #2563eb; }

.btn-secondary { background: #6b7280; }
.btn-secondary:hover { background: #4b5563; }

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-arrow {
    font-size: 10px;
}

/* ===== 主要内容区域 - 左右分栏 ===== */
.builder-content {
    display: flex;
    min-height: 1200px;
    height: auto;
    align-items: stretch;
    overflow: hidden;
}

/* ===== 左侧卡片库 ===== */
.card-library {
    flex: 0 0 60%;
    width: auto;
    min-width: 0;
    border-right: 2px solid #2d3748;
    display: flex;
    flex-direction: column;
    background: #0f172a;
    min-height: 1350px !important;
}

.library-header {
    padding: 15px;
    border-bottom: 1px solid #2d3748;
}

.search-filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.advanced-search-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    border-radius: 30px;
    font-size: 14px;
    background: transparent;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.advanced-search-btn:hover {
    background: #667eea;
    color: white;
}

/* ===== 高级搜索面板 ===== */
.advanced-search-panel {
    background: #1e293b;
    border: 1px solid #2d3748;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease-out;
}

.advanced-search-panel.closing {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
        padding-top: 20px;
        padding-bottom: 20px;
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        max-height: 1000px;
        padding-top: 20px;
        padding-bottom: 20px;
    }
    to {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
}

.advanced-search-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filter-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-row .filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group h3 {
    color: #94a3b8;
    font-size: 13px;
    margin-bottom: 10px;
    font-weight: 500;
}

.filter-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

/* 范围输入组 */
.range-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.range-input-sm {
    width: 80px;
}

.search-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.reset-btn {
    padding: 12px 30px;
    border: 2px solid #4a5568;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.3s;
}

.reset-btn:hover {
    background: #4a5568;
    color: white;
}

/* ===== 自定义下拉菜单 ===== */
.custom-select {
    position: relative;
    width: 100%;
    user-select: none;
}

.select-selected {
    background-color: #1e293b;
    border: 2px solid #2d3748;
    border-radius: 30px;
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
    font-size: 14px;
    color: white;
}

.select-selected:hover {
    border-color: #667eea;
}

.select-selected.active {
    border-color: #667eea;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.select-text {
    flex: 1;
    font-size: 14px;
}

.select-arrow {
    font-size: 12px;
    color: #666;
    transition: transform 0.3s;
}

.select-selected.active .select-arrow {
    transform: rotate(180deg);
}

.select-items {
    position: absolute;
    background-color: #1e293b;
    border: 2px solid #667eea;
    border-top: none;
    border-bottom-left-radius: 30px;
    border-bottom-right-radius: 30px;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.select-items.show {
    display: block;
}

.select-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s;
    font-size: 14px;
    color: white;
}

.select-item:hover {
    background-color: #334155;
}

.select-item.selected {
    background-color: #667eea;
    color: white;
}

.select-item img {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    vertical-align: middle;
}

.filter-input {
    flex: 2;
    padding: 10px 15px;
    border: 2px solid #2d3748;
    border-radius: 30px;
    font-size: 14px;
    background: #1e293b;
    color: white;
    outline: none;
}

.filter-input:focus {
    border-color: #667eea;
}

/* 系列下拉框样式 */
#librarySetFilter {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #2d3748;
    border-radius: 30px;
    font-size: 12px;
    background: #1e293b;
    color: white;
    height: auto;
    min-height: 42px;
    overflow-y: auto;
}

#librarySetFilter option {
    padding: 8px 10px;
    border-bottom: 1px solid #334155;
}

#librarySetFilter option:last-child {
    border-bottom: none;
}

#librarySetFilter option:hover {
    background: #334155;
}

#librarySetFilter option:checked {
    background: #667eea linear-gradient(0deg, #667eea 0%, #667eea 100%);
    color: white;
}

/* ===== 卡片网格 ===== */
.library-grid {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fill, 160px);
    grid-auto-rows: 280px;
    align-content: flex-start;
    justify-content: space-between;
}

/* ===== 卡片项样式 ===== */
.library-card {
    position: relative;
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    width: 100%;
    max-width: 180px;
    margin: 0 auto;
    height: 280px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.library-card img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    display: block;
    background: #0f172a;
    border-radius: 8px 8px 0 0;
    transition: opacity 0.3s ease;
}

/* 懒加载图片 */
.lazy-load-img {
    opacity: 0.6;
}

.lazy-load-img.loaded {
    opacity: 1;
}

/* 卡片信息区域 */
.library-card-info {
    padding: 10px;
    background: #1e293b;
    border-top: 1px solid #334155;
    height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 0 0 12px 12px;
}

.library-card-name {
    font-size: 12px;
    font-weight: bold;
    color: white;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.library-card-details {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: 10px;
    color: #94a3b8;
}

/* 悬浮按钮 */
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 10px;
    pointer-events: none;
    z-index: 10;
}

.library-card:hover .card-overlay {
    opacity: 1;
    pointer-events: auto;
}

.library-card-img-container:hover .card-overlay {
    opacity: 1;
    pointer-events: auto;
}

.card-action-btn {
    width: 90px;
    padding: 8px 12px;
    border-radius: 20px;
    border: none;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.card-action-btn.detail {
    background: #10b981;
    color: white;
}

.card-action-btn.detail:hover {
    background: #059669;
}

.card-action-btn.material {
    background: #8b5cf6;
    color: white;
}

.card-action-btn.main {
    background: #3b82f6;
    color: white;
}

.card-action-btn.side {
    background: #f59e0b;
    color: white;
}

.card-action-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* 禁止图标 */
.card-banned {
    position: absolute;
    top: 0px;
    right: 6px;
    width: 18px;
    height: 18px;
    background: #000000;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
    border: 1.5px solid #ef4444;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-banned::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 2px;
    background: #ef4444;
    transform: rotate(-45deg);
    border-radius: 1px;
    box-shadow: 0 0 1px rgba(239, 68, 68, 0.5);
}

.library-card-zone-count {
    display: none;
}

/* ===== 右侧卡组构建区 ===== */
.deck-building-area {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #0a0f1a;
    height: 100%;
    min-height: 1300px;
}

/* 内部所有容器都透明 */
.deck-tabs {
    display: flex;
    border-bottom: 2px solid #2d3748;
    background: transparent;
    width: 100%;
}

.tab-btn {
    flex: 1;
    padding: 15px 5px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    text-align: center;
}

.tab-btn.active {
    color: white !important;
    border-bottom-color: #667eea !important;
    border-bottom-width: 3px !important;
    background: #2d3748 !important;
}

.deck-cards-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
    background: transparent;
    min-height: 0 !important;
}

.card-list {
    background: transparent;
}

.deck-section {
    display: none;
    background: transparent;
}

.deck-section.active {
    display: block;
    background: transparent;
}

/* 卡片项保留自己的背景色 */
.deck-card-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #1e293b;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #2d3748;
}

.deck-card-item:hover {
    background: #2d3748;
}

.deck-card-item img {
    width: 40px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
}

.deck-card-media {
    position: relative;
    width: 40px;
    flex: 0 0 40px;
}

.deck-card-info {
    flex: 1;
}

/* 卡牌名称区域 */
.deck-card-name {
    font-size: 13px;
    font-weight: bold;
    color: white;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    line-height: 1.4;
    width: 100%;
}

.deck-card-score {
    color: #f59e0b;
    font-size: 11px;
    margin-left: 5px;
}

.deck-card-set {
    font-size: 11px;
    color: #94a3b8;
    display: block;
    visibility: visible;
}

/* 卡片控制区域 */
.deck-card-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* 数量文字样式 */
.deck-card-controls span:first-child {
    color: #94a3b8;
    font-size: 11px;
    margin-right: 2px;
    white-space: nowrap;
}

.deck-card-quantity {
    font-weight: bold;
    color: #667eea;
    min-width: 30px;
    text-align: center;
}

.deck-card-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: none;
    background: #2d3748;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.deck-card-btn:hover {
    background: #4a5568;
}

.deck-card-btn.remove:hover {
    background: #ef4444;
}

.deck-card-media-controls,
.deck-card-media-btn,
.deck-card-media-quantity {
    display: none;
}

.version-select {
    margin-left: 8px;
    font-size: 13px;
    padding: 8px 10px;
    width: 180px;
    height: 40px;
    background: #2d3748;
    color: white;
    border: 1px solid #4a5568;
    border-radius: 6px;
    cursor: pointer;
    box-sizing: border-box;
    vertical-align: middle;
}

.version-select:hover {
    background: #4a5568;
}

.version-select:focus {
    outline: none;
    border-color: #667eea;
}

/* ===== 导入区域 ===== */
.import-area {
    margin: 15px;
    padding: 15px;
    background: #1e293b;
    border-radius: 10px;
}

.import-area textarea {
    width: 100%;
    height: 150px;
    padding: 10px;
    border: 2px solid #2d3748;
    border-radius: 10px;
    font-family: monospace;
    font-size: 14px;
    background: #0f172a;
    color: white;
    margin-bottom: 10px;
    resize: vertical;
}

.import-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ===== 工具类 ===== */
.hidden {
    display: none !important;
}

/* ===== 弹窗 ===== */
.modal {
    display: block;
    position: fixed;
    z-index: 9999998;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #1e293b;
    margin: 15% auto;
    padding: 20px;
    border-radius: 20px;
    width: 80%;
    max-width: 600px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
    border: 1px solid #4a5568;
}

/* Modal 尺寸变体 */
.modal-sm { max-width: 400px; width: 90%; }
.modal-md { max-width: 600px; width: 90%; }
.modal-lg { max-width: 700px; width: 90%; }
.modal-xl { max-width: 800px; width: 90%; }
.modal-full { max-width: 1100px; width: 90%; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: white;
}

.modal-header-compact {
    padding: 15px 20px;
}

.modal-title-sm {
    margin: 0;
    font-size: 16px;
}

.modal-body {
    color: white;
}

.modal-body-compact {
    padding: 15px 20px;
}

.modal-body-scrollable {
    max-height: 70vh;
    overflow-y: auto;
}

.modal-body-scrollable-lg {
    max-height: 80vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

.modal-footer-compact {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 20px 15px;
}

.modal-footer-right {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-footer-between {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 20px;
}

.close {
    color: #94a3b8;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: white;
}

.close-sm {
    font-size: 20px;
}

/* Modal 表单元素 */
.modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #2d3748;
    border-radius: 6px;
    font-size: 14px;
    background: #0f172a;
    color: white;
    box-sizing: border-box;
}

.modal-textarea {
    width: 100%;
    height: 300px;
    padding: 15px;
    border: 2px solid #2d3748;
    border-radius: 10px;
    font-family: monospace;
    font-size: 14px;
    background: #0f172a;
    color: white;
    resize: vertical;
}

.modal-help-text {
    margin-top: 15px;
    color: #94a3b8;
    font-size: 13px;
}

/* 加载文本 */
.loading-text {
    text-align: center;
    padding: 50px;
    color: white;
}

/* 导出代码 textarea */
.export-textarea {
    width: 100%;
    height: 200px;
    padding: 10px;
    border: 2px solid #2d3748;
    border-radius: 10px;
    font-family: monospace;
    font-size: 14px;
    background: #0f172a;
    color: white;
    resize: vertical;
}

/* ===== 页面底部占位 ===== */
.page-bottom-spacer {
    height: 100px;
    width: 100%;
}

/* ===== Library Card 图片容器 ===== */
.library-card-img-container {
    height: 200px;
    background: #2d3748;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.library-card-img-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.library-card:hover .library-card-img-container img {
    pointer-events: none;
}

/* 图片加载失败占位 */
.library-card-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2d3748;
    color: #999;
    font-size: 14px;
}

/* ===== 分页容器 ===== */
.library-pagination-container {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px 15px;
    border-top: 1px solid #2d3748;
    margin-top: 10px;
    background: #0f172a;
}

.library-pagination-info {
    margin-bottom: 15px;
    font-size: 14px;
    color: #94a3b8;
}

/* ===== 加载状态 ===== */
.library-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px;
    color: #94a3b8;
}

/* ===== 错误状态 ===== */
.library-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px;
    color: #ef4444;
}

/* ===== 分数警告提示 ===== */
.score-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    padding: 8px 15px;
    margin: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
}

/* ===== 抽牌结果图片占位 ===== */
.draw-card-img-placeholder {
    width: 60px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2d3748;
    color: #999;
    font-size: 10px;
}

/* ===== 剩余牌库提示 ===== */
.draw-remaining-text {
    color: #94a3b8;
    text-align: center;
    padding: 10px;
}

/* ===== 卡片详情弹窗样式 ===== */
.card-detail-container {
    display: flex;
    gap: 30px;
    color: white;
}

.card-detail-image-wrapper {
    flex: 1;
}

.card-detail-image {
    width: 100%;
    max-width: 300px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.card-detail-image.image-error {
    display: none;
}

.card-detail-no-image {
    width: 100%;
    max-width: 300px;
    height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2d3748;
    color: #999;
    font-size: 14px;
    border-radius: 15px;
}

.card-detail-info {
    flex: 2;
}

.card-detail-name {
    margin: 0 0 5px 0;
    color: white;
}

.card-detail-name-en {
    margin: 0 0 20px 0;
    color: #94a3b8;
    font-size: 16px;
}

.card-meta-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
    padding: 15px;
    background: #1e293b;
    border-radius: 10px;
}

.card-meta-tag {
    background: #0f172a;
    padding: 5px 15px;
    border-radius: 20px;
}

.card-price-loading {
    color: #10b981;
    font-weight: bold;
}

.card-price-has-value {
    color: #10b981;
    font-weight: bold;
}

.card-price-value {
    color: #10b981;
    font-weight: bold;
}

.card-price-no-data {
    color: #cbd5e1;
}

.card-price-error {
    color: #cbd5e1;
}

.card-effect-section {
    margin: 20px 0;
}

.card-section-title {
    color: white;
    margin-bottom: 10px;
}

.card-effect-box {
    background: #1e293b;
    padding: 15px;
    border-radius: 10px;
    min-height: 100px;
}

.card-effect-text {
    color: #94a3b8;
    line-height: 1.6;
    margin: 0;
}

.card-effect-cn {
    margin-top: 10px;
    border-top: 1px solid #334155;
    padding-top: 10px;
}

.card-flavor-section {
    margin: 20px 0;
}

.card-flavor-box {
    background: #1e293b;
    padding: 15px;
    border-radius: 10px;
    font-style: italic;
    color: #94a3b8;
}

.card-stats-box {
    margin: 20px 0;
    padding: 15px;
    background: #1e293b;
    border-radius: 10px;
}

.card-stats-text {
    color: #94a3b8;
    margin: 0;
}

/* 下拉菜单图标 */
.select-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    vertical-align: middle;
}

/* 全宽加载提示 */
.loading-fullwidth {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px;
    color: white;
}

/* ===== 滚动条美化 ===== */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #1e293b;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #667eea;
}

/* ===== 自定义提示框 ===== */
.custom-alert {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999998;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.alert-box {
    background: #1e293b;
    border: 1px solid #4a5568;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 独立的下拉菜单样式 */
.dropdown-menu {
    position: fixed;
    background: #1e293b;
    border: 1px solid #4a5568;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    min-width: 150px;
    z-index: 1000000;
    padding: 5px 0;
}

.dropdown-menu div {
    padding: 10px 15px;
    color: #e2e8f0;
    cursor: pointer;
    border-bottom: 1px solid #334155;
    transition: background 0.2s;
}

.dropdown-menu div:last-child {
    border-bottom: none;
}

.dropdown-menu div:hover {
    background: #4a5568;
    color: white;
}

/* ===== 提示框组件 ===== */
.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #334155;
}

.alert-header h3 {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.alert-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.alert-close:hover {
    color: white;
}

.alert-content {
    color: #e2e8f0;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 25px;
    min-height: 60px;
    white-space: pre-wrap;
    word-break: break-word;
}

.alert-content.warning {
    color: #fbbf24;
}

.alert-content.success {
    color: #4ade80;
}

.alert-content.error {
    color: #f87171;
}

.alert-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.alert-btn {
    padding: 10px 25px;
    border: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.alert-btn.primary {
    background: #667eea;
    color: white;
}

.alert-btn.primary:hover {
    background: #764ba2;
    transform: translateY(-2px);
}

.alert-btn.secondary {
    background: #2d3748;
    color: #e2e8f0;
}

.alert-btn.secondary:hover {
    background: #4a5568;
    transform: translateY(-2px);
}

/* ===== 抽牌结果卡片样式 ===== */
.draw-card-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: #1e293b;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid #334155;
    transition: all 0.2s;
}

.draw-card-item:hover {
    background: #2d3748;
    transform: translateX(5px);
}

.draw-card-item img {
    width: 50px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.draw-card-info {
    flex: 1;
}

.draw-card-name {
    font-size: 16px;
    font-weight: bold;
    color: white;
    margin-bottom: 4px;
}

.draw-card-set {
    font-size: 12px;
    color: #94a3b8;
}

.draw-card-number {
    font-size: 12px;
    color: #f59e0b;
    font-family: monospace;
}

.draw-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: #0f172a;
    border-radius: 10px;
    border: 1px solid #334155;
}

.draw-stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.draw-stat-label {
    font-size: 12px;
    color: #94a3b8;
}

.draw-stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.draw-section-title {
    font-size: 18px;
    font-weight: bold;
    color: white;
    margin: 20px 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 2px solid #334155;
}

.empty-draw {
    text-align: center;
    padding: 50px;
    color: #94a3b8;
    font-size: 16px;
}

/* ===== 模拟起手弹窗专用样式 ===== */
#simulateDrawModal .modal-content {
    max-width: 900px;
    width: 95%;
    margin: 7% auto;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#simulateDrawModal .modal-body {
    max-height: calc(90vh - 150px);
    overflow-y: auto;
    padding: 15px;
}

/* 抽牌结果卡片使用横向布局 */
.draw-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    padding: 10px 0;
}

/* ===== 卡组数据弹窗样式 ===== */
#deckDataModal {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999999;
}

#cardDetailModal {
    z-index: 10000000;
}

.deck-data-modal {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    width: 1700px;
    max-width: 98vw;
    height: 1100px;
    max-height: 98vh;
    overflow: hidden;
    margin: 0;
}

.deck-data-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    background: rgba(0, 0, 0, 0.3);
}

.deck-data-modal .modal-header h2 {
    color: #ffd700;
    margin: 0;
    font-size: 24px;
}

.deck-data-modal .close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 32px;
    cursor: pointer;
    transition: color 0.3s;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.deck-data-modal .close-btn:hover {
    color: white;
}

.deck-data-modal .modal-body {
    padding: 30px;
    overflow-y: auto;
    max-height: calc(98vh - 80px);
    height: calc(1100px - 80px);
}

.deck-data-summary {
    margin-bottom: 20px;
}

.deck-stats-text {
    font-family: monospace;
    line-height: 1.8;
    padding: 15px;
    background: #1e293b;
    border-radius: 8px;
}

.deck-stats-text-title {
    color: #ffd700;
    font-weight: 700;
    margin-bottom: 10px;
}

/* 基础计数器 */
.deck-stats-counters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.counter-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.counter-label {
    color: #888;
    font-size: 12px;
    margin-bottom: 5px;
}

.counter-value {
    color: #ffd700;
    font-size: 24px;
    font-weight: bold;
}

/* 图表容器 */
.deck-charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-box {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 20px;
}

.chart-title {
    color: #ffd700;
    font-size: 16px;
    margin-bottom: 15px;
    text-align: center;
}

/* 稀有度统计 */
.rarity-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.rarity-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

.rarity-label {
    color: #888;
    font-size: 12px;
}

.rarity-value {
    color: #ffd700;
    font-weight: bold;
}

/* 种族分布 */
.tribe-stats {
    margin-bottom: 30px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.tribe-title {
    color: #ffd700;
    font-size: 16px;
    margin-bottom: 10px;
}

.tribe-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tribe-item {
    padding: 5px 10px;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 5px;
    color: #ffd700;
    font-size: 14px;
}

/* 视图切换 */
.view-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.view-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 5px;
    color: #888;
    cursor: pointer;
    transition: all 0.3s;
}

.view-btn.active {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}

/* Grid 视图 */
.deck-grid-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.grid-section {
    margin-bottom: 20px;
}

.grid-section-title {
    color: #ffd700;
    font-size: 14px;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.grid-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.grid-card-item {
    position: relative;
    width: 100px;
    height: 140px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s;
    background: rgba(0, 0, 0, 0.18);
}

.grid-card-item:hover {
    transform: scale(1.05);
}

.grid-card-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    object-position: center;
    image-rendering: auto;
    backface-visibility: hidden;
}

.grid-card-quantity {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 215, 0, 0.9);
    color: #1a1a2e;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* List 视图 */
.deck-list-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.list-section {
    margin-bottom: 20px;
}

.list-section-title {
    color: #ffd700;
    font-size: 16px;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.list-card-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 5px;
    margin-bottom: 5px;
}

.list-card-quantity {
    color: #ffd700;
    font-weight: bold;
    min-width: 30px;
}

.list-card-element {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.list-card-name {
    color: #e0e0e0;
    flex: 1;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
    .filter-row {
        flex-direction: column;
        gap: 15px;
    }

    .filter-row .filter-group {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 768px) {
    body {
        background: radial-gradient(circle at 20% 0%, rgba(247, 197, 72, 0.12), transparent 28%),
            linear-gradient(180deg, #08111f 0%, #0b1424 52%, #050914 100%);
    }

    .main-content {
        padding: 0;
    }

    /* 移动端只重排 Deck Builder 自身结构，桌面分栏尺寸保持在断点外不变。 */
    .container {
        width: 100%;
        max-width: none;
        padding: 0 0 calc(96px + env(safe-area-inset-bottom));
        margin: 0;
    }

    .builder-container {
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
    }

    .builder-header {
        position: sticky;
        top: 0;
        z-index: 920;
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr) auto;
        gap: 8px 10px;
        align-items: center;
        padding: calc(8px + env(safe-area-inset-top)) 12px 10px;
        background: rgba(8, 17, 31, 0.96);
        border-bottom: 1px solid rgba(247, 197, 72, 0.18);
        box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
        backdrop-filter: blur(16px);
    }

    .header-left {
        display: contents;
    }

    .header-left h2 {
        display: none;
    }

    .mobile-builder-back {
        display: inline-flex;
        grid-column: 1;
        grid-row: 1;
        width: 34px;
        height: 34px;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(247, 197, 72, 0.22);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.06);
        color: #f7c548;
        font-size: 28px;
        line-height: 1;
        cursor: pointer;
    }

    .mobile-builder-title {
        display: block;
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
        color: #f8fafc;
        font-size: 16px;
        font-weight: 700;
        line-height: 1.2;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-right {
        grid-column: 3;
        grid-row: 1;
        display: flex;
        gap: 6px;
        align-items: center;
        justify-content: flex-end;
    }

    .header-right #newDeckBtn,
    .header-right #deckEvaluationBtn,
    .header-right #deckDataBtn,
    .header-right #simulateDrawBtn {
        display: none;
    }

    .deck-btn {
        min-height: 34px;
        padding: 7px 10px;
        border-radius: 999px;
        font-size: 13px;
        line-height: 1;
        transform: none;
    }

    .deck-btn:hover {
        transform: none;
    }

    #saveDeckBtn {
        background: linear-gradient(135deg, #f7c548 0%, #d9a73c 100%);
        color: #08111f;
        font-weight: 800;
    }

    #deckActionsBtn {
        border: 1px solid rgba(247, 197, 72, 0.24);
        background: rgba(255, 255, 255, 0.06);
        color: #f7c548;
    }

    .deck-actions-label-desktop {
        display: none;
    }

    .deck-actions-label-mobile {
        display: inline;
    }

    .save-deck-label-desktop {
        display: none;
    }

    .save-deck-label-mobile {
        display: inline;
    }

    .deck-stats-badge {
        grid-column: 1 / -1;
        grid-row: 2;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        width: 100%;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .stat-divider {
        display: none;
    }

    .mobile-only-stat {
        display: flex;
    }

    .stat-divider.mobile-only-stat {
        display: none;
    }

    .stat-item {
        min-width: 0;
        justify-content: center;
        gap: 3px;
        padding: 6px 4px;
        border: 1px solid rgba(247, 197, 72, 0.16);
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.05);
        font-size: 11px;
    }

    .stat-label,
    .stat-max {
        color: #9ba8bc;
        font-size: 10px;
        white-space: nowrap;
    }

    .stat-value {
        color: #f7c548;
        font-size: 12px;
    }

    #sideScore {
        display: none;
    }

    .builder-content {
        display: flex;
        flex-direction: column;
        min-height: 0;
        height: auto;
        gap: 10px;
        padding: 10px 10px 0;
    }

    .deck-building-area,
    .card-library {
        width: 100%;
        min-height: 0 !important;
        height: auto;
        border: 0;
        background: transparent;
    }

    .deck-building-area {
        order: 1;
    }

    .card-library {
        order: 2;
    }

    .deck-tabs {
        gap: 6px;
        padding: 4px;
        border: 1px solid rgba(247, 197, 72, 0.18);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.05);
    }

    .tab-btn {
        min-height: 38px;
        padding: 9px 6px;
        border: 0;
        border-radius: 10px;
        color: #aab6c8;
        font-size: 13px;
        background: transparent;
    }

    .tab-btn.active {
        border: 0 !important;
        background: rgba(247, 197, 72, 0.16) !important;
        color: #f7c548 !important;
        box-shadow: inset 0 0 0 1px rgba(247, 197, 72, 0.28);
    }

    .deck-cards-container {
        min-height: 0 !important;
        max-height: 30vh;
        overflow-y: auto;
        margin-top: 8px;
        padding: 0;
    }

    .deck-section.active {
        display: block;
    }

    .card-list {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .deck-card-item {
        display: grid;
        grid-template-columns: 42px minmax(0, 1fr) auto;
        gap: 8px;
        align-items: center;
        margin: 0;
        padding: 7px;
        border-color: rgba(247, 197, 72, 0.14);
        border-radius: 12px;
        background: rgba(15, 23, 42, 0.78);
    }

    .deck-card-item img {
        width: 42px;
        height: 58px;
        border-radius: 7px;
        object-fit: cover;
    }

    .deck-card-info {
        min-width: 0;
    }

    .deck-card-name {
        display: block;
        color: #f8fafc;
        font-size: 12px;
        line-height: 1.25;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .deck-card-price {
        margin-top: 3px;
        font-size: 11px;
        color: #94a3b8;
    }

    .deck-card-controls {
        display: grid;
        grid-template-columns: repeat(4, auto);
        gap: 4px;
        align-items: center;
        margin-left: 0;
    }

    .deck-card-controls .version-select,
    .deck-card-controls span[style*="数量"] {
        display: none;
    }

    .deck-card-quantity {
        min-width: 22px;
        color: #f7c548;
        font-size: 12px;
    }

    .deck-card-btn {
        width: 25px;
        height: 25px;
        border: 1px solid rgba(247, 197, 72, 0.14);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.07);
        color: #f8fafc;
        font-size: 13px;
    }

    .score-warning {
        margin: 8px 0 0;
        padding: 8px 10px;
        border-radius: 10px;
        font-size: 12px;
    }

    .library-header {
        padding: 2px 0 8px;
        border: 0;
    }

    .mobile-card-pool-title {
        display: block;
        margin: 2px 2px 8px;
        color: #f7c548;
        font-size: 13px;
        font-weight: 700;
        letter-spacing: 0.04em;
    }

    .search-filters {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 108px;
        gap: 8px;
        align-items: stretch;
    }

    #librarySearch {
        grid-column: 1 / -1;
    }

    .filter-input,
    #librarySetFilter,
    .advanced-search-btn {
        min-height: 38px;
        padding: 9px 12px;
        border: 1px solid rgba(247, 197, 72, 0.2);
        border-radius: 12px;
        background: rgba(15, 23, 42, 0.82);
        color: #f8fafc;
        font-size: 13px;
    }

    .advanced-search-btn {
        width: auto;
        color: #f7c548;
        white-space: nowrap;
    }

    .filter-input:focus,
    #librarySetFilter:focus,
    .advanced-search-btn:focus {
        border-color: rgba(247, 197, 72, 0.58);
    }

    .advanced-search-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1300;
        max-height: 72vh;
        overflow-y: auto;
        margin: 0;
        padding: 16px 14px calc(22px + env(safe-area-inset-bottom));
        border: 1px solid rgba(247, 197, 72, 0.24);
        border-bottom: 0;
        border-radius: 20px 20px 0 0;
        background: #0b1424;
        box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.5);
        animation: none;
    }

    .advanced-search-content {
        gap: 12px;
    }

    .filter-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .filter-row .filter-group {
        width: 100%;
        min-width: 0;
    }

    .filter-group h3 {
        margin: 0 0 6px;
        color: #9ba8bc;
        font-size: 12px;
    }

    .filter-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .search-btn,
    .reset-btn {
        width: 100%;
        min-height: 38px;
        padding: 9px 12px;
        border-radius: 12px;
        box-shadow: none;
    }

    .select-selected,
    .range-input-sm {
        border-radius: 12px;
    }

    .library-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-auto-rows: auto;
        justify-content: stretch;
        align-content: flex-start;
        gap: 6px;
        padding: 0;
        overflow: visible;
    }

    .library-card {
        width: 100%;
        max-width: none;
        height: auto;
        min-height: 0;
        margin: 0;
        border: 1px solid rgba(247, 197, 72, 0.12);
        border-radius: 9px;
        background: rgba(15, 23, 42, 0.82);
        box-shadow: none;
    }

    .library-card-img-container,
    .library-card img {
        height: auto;
        min-height: 0;
        aspect-ratio: 63 / 88;
    }

    .library-card-img-container {
        border-radius: 8px 8px 0 0;
        background: rgba(255, 255, 255, 0.04);
    }

    .library-card img {
        width: 100%;
        object-fit: contain;
        border-radius: 8px 8px 0 0;
        background: transparent;
    }

    .library-card-info {
        height: auto;
        min-height: 36px;
        padding: 5px 4px 6px;
        border-top: 1px solid rgba(247, 197, 72, 0.1);
        border-radius: 0 0 9px 9px;
        background: rgba(255, 255, 255, 0.04);
    }

    .library-card-name {
        margin-bottom: 2px;
        font-size: 9px;
        line-height: 1.15;
    }

    .library-card-details {
        gap: 4px;
        font-size: 8px;
    }

    .card-overlay {
        display: none;
    }

    .library-pagination-container {
        padding: 12px 0 0;
        border-top: 1px solid rgba(247, 197, 72, 0.12);
        background: transparent;
    }

    .library-pagination-info {
        font-size: 12px;
    }

    .library-loading,
    .library-error,
    .loading-fullwidth {
        grid-column: 1 / -1;
        min-height: 72px;
        border: 1px solid rgba(247, 197, 72, 0.14);
        border-radius: 14px;
        background: rgba(15, 23, 42, 0.78);
        color: #cbd5e1;
    }

    /* 卡组数据弹窗手机端适配 */
    .deck-data-modal {
        width: 100%;
        max-width: 100%;
        max-height: 95vh;
        border-radius: 20px 20px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
    }

    .deck-data-modal .modal-body {
        max-height: calc(95vh - 80px);
    }

    .deck-stats-counters {
        grid-template-columns: repeat(2, 1fr);
    }

    .deck-charts-container {
        grid-template-columns: 1fr;
    }

    .grid-card-item {
        width: 70px;
        height: 93px;
    }

    .builder-header {
        gap: 8px 8px;
        padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
    }

    .header-right {
        gap: 5px;
    }

    .deck-btn {
        min-width: 0;
        padding: 7px 10px;
    }

    .deck-stats-badge {
        gap: 4px;
        margin-top: 2px;
    }

    .stat-item {
        min-height: 36px;
        padding: 4px 2px;
        border-color: rgba(247, 197, 72, 0.1);
        background: rgba(255, 255, 255, 0.025);
        border-radius: 11px;
    }

    .stat-label,
    .stat-max {
        font-size: 9px;
    }

    .stat-value {
        font-size: 12px;
    }

    .stat-value.caution {
        color: #f7c548;
    }

    .stat-value.ok {
        color: #d8f6d2;
    }

    #mobileLegalityStat,
    #mobileLegalityStat.warning,
    #mobileLegalityStat.caution,
    #mobileLegalityStat.ok {
        font-size: 12px;
        line-height: 1;
    }

    .builder-content {
        gap: 12px;
        padding: 12px 10px 0;
    }

    .deck-building-area,
    .card-library {
        background: transparent;
    }

    .deck-tabs {
        gap: 3px;
        padding: 3px;
        border-radius: 16px;
        border-color: rgba(255, 255, 255, 0.05);
        background: rgba(255, 255, 255, 0.015);
        box-shadow: none;
    }

    .tab-btn {
        min-height: 40px;
        padding: 10px 6px;
        font-size: 13px;
        font-weight: 700;
        letter-spacing: 0.01em;
    }

    .tab-btn.active {
        background: rgba(247, 197, 72, 0.1) !important;
        color: #ffe9b3 !important;
        box-shadow: inset 0 0 0 1px rgba(247, 197, 72, 0.18);
    }

    .mobile-zone-strip {
        display: flex;
        justify-content: flex-end;
        margin-top: 6px;
        padding: 2px 2px 0;
        color: #cbd5e1;
    }

    .mobile-zone-strip-label {
        display: none;
    }

    .mobile-zone-strip-count {
        display: inline-flex;
        align-items: center;
        min-height: 20px;
        padding: 0 8px;
        border: 1px solid rgba(247, 197, 72, 0.14);
        border-radius: 999px;
        background: rgba(247, 197, 72, 0.06);
        color: #d8e0ef;
        font-size: 10px;
        font-weight: 600;
    }

    .score-warning {
        margin: 6px 0 0;
        padding: 6px 2px 2px;
        border: 0;
        border-top: 1px solid rgba(247, 197, 72, 0.2);
        border-radius: 0;
        background: transparent;
        color: rgba(247, 197, 72, 0.85);
        font-size: 10px;
        line-height: 1.25;
    }

    .deck-cards-container {
        max-height: 38vh;
        margin-top: 6px;
        padding: 7px;
        border: 1px solid rgba(255, 255, 255, 0.04);
        border-radius: 12px;
        background: rgba(9, 15, 27, 0.34);
        box-shadow: none;
    }

    .card-list {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    /* 主卡组区向下留出额外呼吸空间（移动端自适应，避免写死百分比导致不同机型错位） */
    #mainSection.active .card-list {
        margin-top: clamp(8px, 2.4vh, 18px);
    }

    .deck-card-item {
        display: flex;
        flex-direction: column;
        gap: 6px;
        align-items: stretch;
        padding: 6px;
        border-radius: 12px;
        border-color: rgba(247, 197, 72, 0.06);
        background: rgba(16, 24, 40, 0.62);
        box-shadow: none;
    }

    .deck-card-media {
        width: 100%;
        flex: none;
    }

    .deck-card-item img {
        width: 100%;
        height: auto;
        aspect-ratio: 63 / 88;
        border-radius: 9px;
        object-fit: cover;
        background: rgba(255, 255, 255, 0.03);
    }

    .deck-card-info {
        width: 100%;
        min-width: 0;
    }

    .deck-card-name {
        display: block;
        font-size: 9.5px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: #e8eefb;
    }

    .deck-card-score,
    .deck-card-price,
    .deck-card-controls {
        display: none;
    }

    .deck-card-media-controls {
        position: absolute;
        left: 8px;
        right: 8px;
        bottom: 8px;
        z-index: 2;
        display: grid;
        grid-template-columns: 28px minmax(0, 1fr) 28px;
        align-items: center;
        gap: 6px;
        min-height: 30px;
        padding: 2px 4px;
        border: 1px solid rgba(255, 255, 255, 0.11);
        border-radius: 10px;
        background: linear-gradient(
            180deg,
            rgba(8, 12, 20, 0.32) 0%,
            rgba(8, 12, 20, 0.58) 100%
        );
        backdrop-filter: blur(2px);
    }

    .deck-card-media-btn {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        min-width: 24px;
        padding: 0;
        border: 1px solid rgba(247, 197, 72, 0.34);
        border-radius: 7px;
        background: rgba(10, 16, 28, 0.72);
        color: #f4f7ff;
        font-size: 14px;
        line-height: 1;
        font-weight: 800;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* 扩大真实可点击区域到触控友好尺寸（44x44） */
    .deck-card-media-btn::before {
        content: "";
        position: absolute;
        left: 50%;
        top: 50%;
        width: 44px;
        height: 44px;
        transform: translate(-50%, -50%);
    }

    .deck-card-media-btn:active {
        background: rgba(247, 197, 72, 0.22);
        border-color: rgba(247, 197, 72, 0.56);
    }

    .deck-card-media-quantity {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 22px;
        min-width: 28px;
        padding: 0 8px;
        border-radius: 999px;
        border: 1px solid rgba(247, 197, 72, 0.34);
        background: rgba(247, 197, 72, 0.16);
        color: #f4d98d;
        font-size: 12px;
        font-weight: 800;
    }

    .library-header {
        padding: 0;
    }

    .mobile-pool-heading {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        margin: 2px 2px 8px;
    }

    .mobile-card-pool-title {
        margin: 0;
        font-size: 13px;
        letter-spacing: 0.06em;
    }

    .search-filters {
        gap: 7px;
    }

    .filter-input,
    #librarySetFilter,
    .advanced-search-btn {
        min-height: 40px;
        border-radius: 13px;
        background: rgba(15, 23, 42, 0.78);
    }

    .advanced-search-btn {
        font-size: 12px;
    }

    .library-grid {
        gap: 8px;
        padding: 0;
    }

    .library-card {
        border-color: rgba(247, 197, 72, 0.1);
        border-radius: 10px;
        background: rgba(13, 20, 35, 0.68);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.16);
    }

    .library-card.is-in-active-zone {
        border-color: rgba(247, 197, 72, 0.28);
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    }

    .library-card-img-container {
        border-radius: 10px;
        overflow: hidden;
    }

    .library-card img {
        border-radius: 10px;
    }

    .library-card-info {
        min-height: 0;
        padding: 4px 2px 2px;
        border-top: 0;
        background: transparent;
        border-radius: 0;
    }

    .library-card-name {
        margin: 0;
        color: #9ba8bc;
        font-size: 9px;
        font-weight: 600;
    }

    .library-card-details {
        display: none;
    }

    .library-card-zone-count {
        position: absolute;
        right: 6px;
        bottom: 6px;
        z-index: 2;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 22px;
        height: 22px;
        padding: 0 6px;
        border-radius: 999px;
        background: rgba(247, 197, 72, 0.96);
        color: #08111f;
        font-size: 11px;
        font-weight: 800;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    }

    .library-card-zone-count[hidden] {
        display: none;
    }

    .library-pagination-container {
        margin-top: 14px;
        margin-left: -10px;
        margin-right: -10px;
        padding: 12px 10px 0;
        border-top-color: rgba(247, 197, 72, 0.1);
        width: auto;
    }

    .library-pagination-container .library-pagination-info {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }

    .library-pagination-container #libraryPaginationButtons {
        width: 100%;
    }

    .library-pagination-container .pagination {
        width: 100%;
        margin: 0;
        gap: 6px;
        justify-content: center;
        align-items: center;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .library-pagination-container .pagination::-webkit-scrollbar {
        display: none;
    }

    .library-pagination-container .page-btn {
        flex: 0 0 auto;
        min-width: 40px;
        min-height: 40px;
        padding: 0 6px;
        border-radius: 10px;
        font-size: 14px;
    }

    .library-pagination-container .page-btn.ellipsis {
        flex: 0 0 28px;
        min-width: 28px;
    }
}

.stat-item-action {
    border: none;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

.stat-item-action:focus-visible {
    outline: 2px solid rgba(247, 197, 72, 0.6);
    outline-offset: 1px;
}

.library-card-set-abbr {
    margin-bottom: 2px;
    color: #f7c548;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-align: center;
}

.mobile-deck-builder-page .deck-card-set-abbr {
    margin-top: 2px;
    color: #f7c548;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.mobile-deck-builder-page .deck-card-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.mobile-deck-builder-page .deck-card-inline-controls {
    display: none;
}

.mobile-deck-builder-page .deck-card-meta-row {
    display: none;
}

.mobile-drop-fly-token {
    position: fixed;
    z-index: 1410;
    pointer-events: none;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
    transition: transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 360ms ease;
}

.ga-unified-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ga-unified-pager[hidden] {
    display: none !important;
}

.library-pagination-container[hidden] {
    display: none !important;
}

.ga-unified-pager-btn {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(247, 197, 72, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: #dce6f7;
    font-size: 12px;
    cursor: pointer;
}

.ga-unified-pager-btn:disabled {
    opacity: 0.38;
    cursor: default;
}

.ga-unified-pager-indicator {
    min-width: 64px;
    text-align: center;
    color: #f2f6ff;
    font-size: 12px;
    font-weight: 700;
}

@media (max-width: 768px) {
    .mobile-deck-builder-page .mobile-builder-back {
        width: 28px !important;
        height: 28px !important;
        border: none !important;
        border-radius: 8px !important;
        background: transparent !important;
        color: #dce6f7 !important;
        font-size: 20px !important;
    }

    .mobile-deck-builder-page .header-right #newDeckBtn,
    .mobile-deck-builder-page .header-right #deckEvaluationBtn,
    .mobile-deck-builder-page .header-right #deckDataBtn,
    .mobile-deck-builder-page .header-right #simulateDrawBtn {
        display: none !important;
    }

    .mobile-deck-builder-page .deck-stats-badge {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px !important;
    }

    .mobile-deck-builder-page .deck-building-area {
        overflow: visible;
    }

    .mobile-deck-builder-page .mobile-deck-empty-hint {
        margin-top: 6px;
        padding: 8px 10px;
        border: 1px dashed rgba(247, 197, 72, 0.32);
        border-radius: 10px;
        background: rgba(247, 197, 72, 0.06);
        color: #d9e2f0;
        font-size: 11px;
        line-height: 1.35;
    }

    .mobile-deck-builder-page .mobile-zone-strip {
        display: none !important;
    }

    .mobile-deck-builder-page .deck-cards-container {
        max-height: 48vh !important;
        padding: 6px !important;
        overflow-y: auto !important;
    }

    .mobile-deck-builder-page .card-list {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        margin-top: 0 !important;
    }

    .mobile-deck-builder-page .deck-card-item {
        display: grid !important;
        grid-template-columns: 36px minmax(0, 1fr) !important;
        grid-template-areas: "media info" !important;
        gap: 4px 6px !important;
        align-items: center !important;
        padding: 6px !important;
        border-radius: 8px !important;
    }

    .mobile-deck-builder-page .deck-card-media {
        grid-area: media !important;
        width: 36px !important;
        flex: 0 0 36px !important;
    }

    .mobile-deck-builder-page .deck-card-item img {
        width: 36px !important;
        height: 50px !important;
        aspect-ratio: auto !important;
        border-radius: 5px !important;
        object-fit: cover !important;
    }

    .mobile-deck-builder-page .deck-card-info {
        grid-area: info !important;
        width: 100% !important;
        min-width: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 2px !important;
    }

    .mobile-deck-builder-page .deck-card-top-row {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 4px !important;
        min-width: 0 !important;
    }

    .mobile-deck-builder-page .deck-card-name {
        font-size: 11px !important;
        line-height: 1.15 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        flex: 1 1 auto !important;
    }

    .mobile-deck-builder-page .deck-card-set-abbr {
        display: inline-flex !important;
        align-items: center !important;
        flex: 0 0 auto !important;
        margin-top: 0 !important;
        font-size: 9px !important;
        line-height: 1 !important;
    }

    .mobile-deck-builder-page .deck-card-meta-row {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        margin-top: 1px;
        min-width: 0 !important;
    }

    .mobile-deck-builder-page .deck-card-version-row {
        display: none !important;
    }

    .mobile-deck-builder-page .deck-card-meta-row .version-select-inline {
        display: inline-block !important;
        width: auto !important;
        max-width: 116px !important;
        height: 18px !important;
        font-size: 9px !important;
        padding: 0 4px !important;
        margin-left: 0 !important;
        border-radius: 5px !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }

    .mobile-deck-builder-page .deck-card-price {
        display: block !important;
        margin-top: 0 !important;
        font-size: 10px !important;
        line-height: 1.1 !important;
        color: #00e39a !important;
    }

    .mobile-deck-builder-page .deck-card-controls {
        display: none !important;
    }

    .mobile-deck-builder-page .deck-card-inline-controls {
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
        flex: 0 0 auto !important;
    }

    .mobile-deck-builder-page .deck-card-quantity-inline {
        min-width: 10px !important;
        text-align: center !important;
        color: #f7c548 !important;
        font-size: 10px !important;
        font-weight: 800 !important;
    }

    .mobile-deck-builder-page .deck-card-btn.inline {
        width: 22px !important;
        height: 22px !important;
        min-width: 22px !important;
        min-height: 22px !important;
        max-width: 22px !important;
        max-height: 22px !important;
        aspect-ratio: 1 / 1 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 12px !important;
        border-radius: 6px !important;
        line-height: 1 !important;
        padding: 0 !important;
    }

    .mobile-deck-builder-page .deck-card-media-controls {
        display: none !important;
    }

    .mobile-deck-builder-page .mobile-deck-zone-pagination {
        margin-top: 8px;
        padding: 2px 0 0;
    }

    .mobile-deck-builder-page .library-pagination-container {
        margin-top: 10px !important;
        padding-top: 8px !important;
    }

    .mobile-deck-builder-page .library-pagination-container .library-pagination-info {
        display: none !important;
    }

    .mobile-deck-builder-page .library-pagination-container #libraryPaginationButtons {
        display: none !important;
    }

    .mobile-deck-builder-page .library-pagination-container-mobile-unified {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .mobile-library-dragging [data-mobile-drop-zone] {
        box-shadow: inset 0 0 0 1px rgba(247, 197, 72, 0.24);
    }

    body.mobile-drag-scroll-lock {
        overflow: hidden !important;
        overscroll-behavior: none !important;
        touch-action: none !important;
    }

    body.mobile-drag-scroll-lock .mobile-deck-builder-page,
    body.mobile-drag-scroll-lock .mobile-deck-builder-page .builder-content,
    body.mobile-drag-scroll-lock .mobile-deck-builder-page .card-library,
    body.mobile-drag-scroll-lock .mobile-deck-builder-page .library-grid {
        touch-action: none !important;
    }

    .mobile-deck-builder-page [data-mobile-drop-zone].is-mobile-drop-target {
        box-shadow: inset 0 0 0 2px rgba(247, 197, 72, 0.62) !important;
        background: rgba(247, 197, 72, 0.12) !important;
    }

    .mobile-library-drag-ghost {
        position: fixed;
        z-index: 1400;
        pointer-events: none;
        min-height: 28px;
        padding: 4px 10px;
        border: 1px solid rgba(247, 197, 72, 0.52);
        border-radius: 999px;
        background: rgba(8, 17, 31, 0.92);
        color: #f7c548;
        font-size: 11px;
        font-weight: 700;
        line-height: 1.2;
        transform: translate(-50%, -50%);
        box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
    }

    .mobile-deck-builder-page .deck-data-modal .view-toggle {
        display: none !important;
    }

    .mobile-deck-builder-page .builder-header {
        position: static !important;
        top: auto !important;
        z-index: auto !important;
    }

    .mobile-deck-builder-page #mobileQuickCardModal {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px 0 16px;
    }

    .mobile-deck-builder-page .mobile-quick-card-modal {
        width: min(92vw, 420px);
        margin: 3vh auto;
        max-height: calc(100vh - 32px);
        border-radius: 16px;
        border: 1px solid rgba(247, 197, 72, 0.22);
        background: #101a2c;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .mobile-deck-builder-page .mobile-quick-card-body {
        display: flex;
        flex-direction: column;
        gap: 8px;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-deck-builder-page .mobile-quick-card-image-wrap {
        width: 100%;
        border-radius: 12px;
        overflow: hidden;
        border: 1px solid rgba(247, 197, 72, 0.18);
        background: rgba(0, 0, 0, 0.24);
    }

    .mobile-deck-builder-page .mobile-quick-card-image-wrap img {
        width: 100%;
        height: auto;
        max-height: 44vh;
        object-fit: contain;
        display: block;
    }

    .mobile-deck-builder-page .mobile-quick-card-meta {
        display: flex;
        flex-direction: column;
        gap: 3px;
    }

    .mobile-deck-builder-page .mobile-quick-card-name {
        color: #f2f6ff;
        font-size: 14px;
        font-weight: 700;
        line-height: 1.35;
        word-break: break-word;
    }

    .mobile-deck-builder-page .mobile-quick-card-set {
        color: #9fb1cb;
        font-size: 11px;
        letter-spacing: 0.04em;
    }

    .mobile-deck-builder-page .mobile-quick-card-qty {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        margin-top: 2px;
    }

    .mobile-deck-builder-page .mobile-quick-qty-btn {
        width: 30px;
        height: 30px;
        border-radius: 8px;
        border: 1px solid rgba(247, 197, 72, 0.26);
        background: rgba(255, 255, 255, 0.06);
        color: #f2f6ff;
        font-size: 18px;
        line-height: 1;
    }

    .mobile-deck-builder-page .mobile-quick-qty-value {
        min-width: 24px;
        text-align: center;
        color: #f7c548;
        font-size: 22px;
        font-weight: 800;
        line-height: 1;
    }

    .mobile-deck-builder-page .mobile-quick-card-footer {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .mobile-deck-builder-page .mobile-quick-card-footer .deck-btn {
        width: 100%;
        min-height: 32px;
        border-radius: 8px;
        font-size: 12px;
    }
}
