/* Deck Builder workspace — stable layout overrides */

body.deck-builder-page {
    background: #0f1115 !important;
    color: #eef1f6;
    --db-line: #2c3340;
    --db-muted: #9aa3b2;
    --db-accent: #fbc11c;
}

body.deck-builder-page::before {
    display: none !important;
}

.deck-builder-page .deck-builder-container {
    padding-top: 12px !important;
    padding-bottom: 96px !important;
    max-width: 90%;
    margin: 0 auto;
    overflow-x: hidden;
    box-sizing: border-box;
    width: 100%;
}

.deck-builder-page .deck-builder-container > .container-fluid {
    padding-left: 12px !important;
    padding-right: 12px !important;
    max-width: 100%;
    width: 100%;
    overflow-x: hidden !important;
    box-sizing: border-box;
}

/* neutralize broken global .row rules inside this page */
.deck-builder-page .db-filter-row.row {
    display: block !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.deck-builder-page .db-filter-row > .col-12 {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* —— top bar —— */
.db-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: #171a21;
    border: 1px solid #2c3340;
    border-radius: 10px;
}

.db-bar__left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    min-width: 0;
}

.db-bar__brand {
    font-weight: 800;
    font-size: 0.95rem;
    white-space: nowrap;
}

.db-bar__name {
    color: #8b93a3;
    font-size: 0.85rem;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.db-bar__meters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.db-meter {
    min-width: 100px;
}

.db-meter__label {
    font-size: 0.7rem;
    color: #8b93a3;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.db-meter__row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.db-meter__value {
    font-size: 0.85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 3.4rem;
}

.db-meter__track {
    flex: 1;
    height: 6px;
    min-width: 70px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    overflow: hidden;
}

.db-meter__fill {
    height: 100%;
    width: 0%;
    background: #fbc11c;
    border-radius: 99px;
    transition: width 0.2s ease;
}

.db-meter__fill.is-over {
    background: #c45757;
}

.db-bar__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.db-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid #2c3340;
    background: #1e232d;
    color: #eef1f6;
    font-size: 0.8125rem;
    font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
}

.db-btn:hover {
    border-color: rgba(251, 193, 28, 0.5);
    color: #fff;
}

.db-btn--primary {
    background: #fbc11c;
    border-color: transparent;
    color: #1a1400;
}

.db-btn--primary:hover {
    filter: brightness(1.05);
    color: #1a1400;
    background: #fbc11c;
}

.db-btn--ghost {
    background: transparent;
}

.db-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* —— filter: clean 2-line layout —— */
.deck-builder-page .filter-panel.filter-panel--kuse {
    background: #171a21 !important;
    border: 1px solid #2c3340 !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    margin-bottom: 12px !important;
    padding: 14px 16px !important;
    overflow: visible !important;
}

.deck-builder-page .db-filter-simple {
    width: 100% !important;
    display: block !important;
}

.deck-builder-page .db-filter-simple,
.deck-builder-page .db-filter-simple * {
    box-sizing: border-box;
}

.deck-builder-page .db-filter-primary {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
    width: 100% !important;
    margin: 0 !important;
}

.deck-builder-page .db-filter-line--main,
.deck-builder-page .db-filter-line--color {
    display: grid !important;
    grid-template-columns: minmax(220px, 1.7fr) minmax(150px, 1.25fr) repeat(5, minmax(0, 1fr)) 168px !important;
    gap: 8px 10px !important;
    align-items: end !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: visible !important;
    flex: none !important;
}

.deck-builder-page .db-filter-line--color .db-filter-field,
.deck-builder-page .db-filter-line--color .db-filter-field--search,
.deck-builder-page .filter-panel--kuse .deck-filter-kuse.db-filter-simple .db-filter-line--main > .db-filter-field,
.deck-builder-page .filter-panel--kuse .deck-filter-kuse.db-filter-simple .db-filter-line--color > .db-filter-field {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: none !important;
}

.deck-builder-page .db-filter-field,
.deck-builder-page .filter-panel--kuse .deck-filter-kuse.db-filter-simple .db-filter-field {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: flex-end !important;
    gap: 5px !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
}

.deck-builder-page .filter-panel--kuse .deck-filter-kuse.db-filter-simple .db-filter-field--search {
    width: 180px !important;
    max-width: 220px !important;
}

.deck-builder-page .filter-panel--kuse .deck-filter-kuse.db-filter-simple .db-filter-field--actions {
    width: auto !important;
    max-width: none !important;
}

.deck-builder-page .db-filter-field--actions {
    width: auto !important;
    min-width: max-content !important;
}

.deck-builder-page .db-filter-actions-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    width: auto !important;
}

.deck-builder-page .db-filter-actions-row .db-btn {
    min-height: 38px;
    padding: 0 14px;
    white-space: nowrap;
}

.deck-builder-page .db-filter-label-spacer {
    visibility: hidden !important;
    height: 1.05em !important;
    line-height: 1.05em !important;
}

.deck-builder-page .db-filter-color-label,
.deck-builder-page .db-filter-simple .deck-filter-field__label,
.deck-builder-page .filter-panel--kuse .deck-filter-kuse.db-filter-simple .deck-filter-field__label,
.deck-builder-page .filter-panel--kuse .deck-filter-kuse.db-filter-simple label.deck-filter-field__label,
.deck-builder-page .filter-panel--kuse .deck-filter-kuse.db-filter-simple span.deck-filter-field__label {
    display: block !important;
    flex: none !important;
    flex-basis: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
    line-height: 1.3 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #9aa3b2 !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em;
}

.deck-builder-page .db-filter-color-label {
    flex: 0 0 auto !important;
    min-width: 2.5rem;
}

.deck-builder-page .db-filter-field .form-control,
.deck-builder-page .db-filter-field select.form-control,
.deck-builder-page .db-filter-field input.form-control,
.deck-builder-page .filter-panel--kuse .db-filter-simple .form-control,
.deck-builder-page .filter-panel--kuse .db-filter-simple #variantFilter {
    min-height: 38px !important;
    height: 38px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: none !important;
    margin: 0 !important;
    border-radius: 8px !important;
    background: #12151c !important;
    border: 1px solid #343b4a !important;
    color: #eef1f6 !important;
}

/* 徹底關掉舊 kuse「標籤橫排 + 5em」對新篩選的干擾 */
.deck-builder-page .filter-panel--kuse .deck-filter-kuse.db-filter-simple .db-filter-field,
.deck-builder-page .filter-panel--kuse .deck-filter-kuse.db-filter-simple .deck-filter-field {
    flex-direction: column !important;
    align-items: stretch !important;
    flex-wrap: nowrap !important;
}

.deck-builder-page .db-filter-field .form-control:focus,
.deck-builder-page .filter-panel--kuse .db-filter-simple .form-control:focus {
    border-color: #fbc11c !important;
    box-shadow: 0 0 0 3px rgba(251, 193, 28, 0.16) !important;
}

.deck-builder-page .db-filter-field .cost-range-row,
.deck-builder-page .db-filter-field .sort-row {
    display: flex !important;
    gap: 6px !important;
    align-items: center !important;
    width: 100% !important;
    margin: 0 !important;
}

.deck-builder-page .db-filter-field .cost-range-row .form-control,
.deck-builder-page .db-filter-field .sort-row .form-control {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    width: auto !important;
}

.deck-builder-page .db-filter-simple #colorFilterWrap.color-filter-chips--swatch,
.deck-builder-page .filter-panel--kuse .db-filter-simple #colorFilterWrap.color-filter-chips--swatch {
    display: flex !important;
    flex: none !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    gap: 6px !important;
    height: 38px !important;
    min-height: 38px !important;
    align-items: center !important;
    overflow: hidden !important;
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
}

.deck-builder-page .db-filter-field--color .deck-filter-field__label {
    text-align: center !important;
}

.deck-builder-page .db-filter-simple .color-chip--swatch {
    width: 22px !important;
    height: 22px !important;
    min-width: 0 !important;
    flex: 0 0 22px !important;
    margin: 0 !important;
}

.deck-builder-page .deck-filter-actions__btn--primary,
.deck-builder-page .dark-btn {
    background: #fbc11c !important;
    color: #1a1400 !important;
    border: none !important;
    box-shadow: none !important;
}

.deck-builder-page .db-filter-field.select-focused,
.deck-builder-page .db-filter-field.typeahead-open {
    z-index: 1200;
    position: relative;
}

.deck-builder-page .color-filter-chips--swatch .color-chip--swatch.active {
    box-shadow: 0 0 0 2px #0f1115, 0 0 0 4px #fbc11c !important;
}

@media (max-width: 1199.98px) {
    .deck-builder-page .db-filter-actions-row {
        width: auto !important;
        justify-content: flex-end;
    }

    /* 平板：兩列改為可換行的多欄，避免 8 欄固定寬撐破 */
    .deck-builder-page .db-filter-line--main,
    .deck-builder-page .db-filter-line--color {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 10px 8px !important;
        align-items: end !important;
    }

    .deck-builder-page .filter-panel--kuse .deck-filter-kuse.db-filter-simple .db-filter-field--search,
    .deck-builder-page .db-filter-field--search,
    .deck-builder-page .db-filter-field--actions {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
    }

    .deck-builder-page .db-filter-line--main > .db-filter-field--actions {
        grid-column: span 2;
    }

    .deck-builder-page .db-filter-line--color > .db-filter-field--color {
        grid-column: 1 / -1;
    }

    .deck-builder-page .db-filter-simple #colorFilterWrap.color-filter-chips--swatch,
    .deck-builder-page .filter-panel--kuse .db-filter-simple #colorFilterWrap.color-filter-chips--swatch {
        flex-wrap: wrap !important;
        justify-content: center !important;
        height: auto !important;
        min-height: 38px !important;
        overflow: visible !important;
        row-gap: 6px !important;
    }

    .deck-builder-page .db-filter-actions-row {
        width: 100% !important;
    }

    .deck-builder-page .db-filter-actions-row .db-btn {
        flex: 1 1 0;
    }
}

@media (max-width: 767.98px) {
    .deck-builder-page .deck-builder-container {
        max-width: 100% !important;
        padding-left: max(8px, env(safe-area-inset-left, 0px)) !important;
        padding-right: max(8px, env(safe-area-inset-right, 0px)) !important;
    }

    .deck-builder-page .deck-builder-container > .container-fluid {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .deck-builder-page .filter-panel.filter-panel--kuse {
        padding: 10px !important;
    }

    .deck-builder-page .db-filter-line--main,
    .deck-builder-page .db-filter-line--color {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px 8px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .deck-builder-page .db-filter-line--main > .db-filter-field--search,
    .deck-builder-page .db-filter-line--color > .db-filter-field--search,
    .deck-builder-page .db-filter-line--color > .db-filter-field--color {
        grid-column: 1 / -1;
    }

    /* 主列剩奇數欄時，「普異」會獨佔左格；改滿寬避免右側空一格 */
    .deck-builder-page .db-filter-line--main > .db-filter-field:nth-last-child(2) {
        grid-column: 1 / -1;
    }

    .deck-builder-page .db-filter-field--actions {
        grid-column: 1 / -1 !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .deck-builder-page .filter-panel--kuse .deck-filter-kuse.db-filter-simple .db-filter-field,
    .deck-builder-page .filter-panel--kuse .deck-filter-kuse.db-filter-simple .db-filter-field--search,
    .deck-builder-page .db-filter-field,
    .deck-builder-page .db-filter-field--search {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .deck-builder-page .db-filter-simple #colorFilterWrap.color-filter-chips--swatch,
    .deck-builder-page .filter-panel--kuse .db-filter-simple #colorFilterWrap.color-filter-chips--swatch {
        flex-wrap: wrap !important;
        justify-content: center !important;
        height: auto !important;
        min-height: 38px !important;
        overflow: visible !important;
        row-gap: 6px !important;
    }

    .deck-builder-page .db-filter-field--color .deck-filter-field__label {
        text-align: center !important;
    }

    .deck-builder-page .db-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .deck-builder-page .db-bar__left,
    .deck-builder-page .db-bar__actions {
        width: 100%;
    }

    .deck-builder-page .db-bar__actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .deck-builder-page .db-bar__actions .db-btn {
        width: 100%;
        min-width: 0;
        white-space: normal;
        text-align: center;
    }

    /* 第 3 顆起（儲存、開啟牌組）改滿寬，避免儲存只佔左半欄 */
    .deck-builder-page .db-bar__actions .db-btn:nth-child(n+3),
    .deck-builder-page .db-bar__actions #saveDeckBtnBar {
        grid-column: 1 / -1;
    }

    .deck-builder-page .db-bar__name {
        max-width: 100%;
    }
}

@media (max-width: 420px) {
    .deck-builder-page .db-filter-line--main,
    .deck-builder-page .db-filter-line--color {
        grid-template-columns: 1fr !important;
    }

    .deck-builder-page .db-filter-line--main > .db-filter-field--search,
    .deck-builder-page .db-filter-line--color > .db-filter-field--search,
    .deck-builder-page .db-filter-line--color > .db-filter-field--color,
    .deck-builder-page .db-filter-field--actions {
        grid-column: 1 !important;
    }
}

/* —— workspace —— */
.deck-builder-page .db-workspace {
    display: grid !important;
    /* 詳情（左）| 卡表 = 4:6 */
    grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
    gap: 12px;
    align-items: start;
    width: 100%;
    margin: 0 0 12px;
    float: none !important;
}

.deck-builder-page .db-browse {
    min-width: 0;
    width: 100%;
    background: #171a21;
    border: 1px solid #2c3340;
    border-radius: 10px;
    padding: 12px;
}

.deck-builder-page .db-browse__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.deck-builder-page .db-browse__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.deck-builder-page .db-browse__meta {
    color: #8b93a3;
    font-size: 0.8rem;
    font-weight: 500;
}

.deck-builder-page .card-detail-col {
    display: none !important;
}

.deck-builder-page .card-list-col,
.deck-builder-page .card-list-col .dark-card {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
}

/* —— card detail side panel（對齊 DTCG dtcg-detail-layout） —— */
.deck-builder-page .db-detail {
    order: 0;
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    display: flex;
    flex-direction: column;
    background: #171a21;
    border: 1px solid #2c3340;
    border-radius: 10px;
    overflow: hidden;
    width: 100%;
    min-width: 0;
}

.deck-builder-page .db-detail__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #2c3340;
    flex-shrink: 0;
}

.deck-builder-page .db-detail__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
}

.deck-builder-page .db-detail .card-detail-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.deck-builder-page .db-detail #cardDetailPanelContent.card-detail-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.deck-builder-page .db-detail .card-detail-placeholder,
.deck-builder-page .db-detail-placeholder {
    padding: 48px 16px;
    color: #9aa3b2;
    font-size: 0.85rem;
    text-align: center;
}

.deck-builder-page .db-detail-layout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.deck-builder-page .db-detail-image {
    flex: none;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 14px 16px 8px;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(251, 193, 28, 0.14), transparent 62%),
        #12151c;
}

.deck-builder-page .db-detail-image img {
    width: auto;
    max-width: min(100%, 280px);
    max-height: min(42vh, 360px);
    height: auto;
    margin: 0 auto;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
    background: #fff;
    display: block;
}

.deck-builder-page .db-detail-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
}

.deck-builder-page .db-detail-scroll {
    padding: 14px 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.deck-builder-page .db-detail-head {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.deck-builder-page .db-detail-idrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.deck-builder-page .db-detail-id {
    font-size: 0.95rem;
    color: #9aa3b2;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.deck-builder-page .db-detail-rare {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: #2c3340;
    color: #eef1f6;
}

.deck-builder-page .db-detail-rare.is-sp,
.deck-builder-page .db-detail-rare.is-sec,
.deck-builder-page .db-detail-rare.is-ur {
    background: linear-gradient(120deg, #b45309, #d97706 45%, #f59e0b);
    color: #fff;
}

.deck-builder-page .db-detail-rare.is-sr,
.deck-builder-page .db-detail-rare.is-p-sr {
    background: linear-gradient(120deg, #6d28d9, #7c3aed);
    color: #fff;
}

.deck-builder-page .db-detail-name {
    font-size: 1.55rem;
    font-weight: 800;
    color: #eef1f6;
    line-height: 1.3;
    margin: 0;
}

.deck-builder-page .db-detail-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.deck-builder-page .db-detail-chip {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    background: #232833;
    color: #d5dae3;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #343b4a;
}

.deck-builder-page .db-detail-chip:hover {
    border-color: rgba(251, 193, 28, 0.55);
    color: #fbc11c;
}

.deck-builder-page .db-detail-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.deck-builder-page .db-detail-stat {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid #2c3340;
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
}

.deck-builder-page .db-detail-stat .k {
    display: block;
    font-size: 0.78rem;
    color: #8b93a3;
    margin-bottom: 3px;
    font-weight: 600;
}

.deck-builder-page .db-detail-stat .v {
    display: block;
    font-size: 1.05rem;
    color: #eef1f6;
    font-weight: 700;
    line-height: 1.2;
    word-break: break-all;
}

.deck-builder-page .db-detail-section-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #8b93a3;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.deck-builder-page .db-detail-effect {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #d5dae3;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid #2c3340;
    border-radius: 12px;
}

.deck-builder-page .db-detail-effect .effect-chip {
    display: inline-block;
    padding: 2px 8px;
    margin: 0 2px;
    border-radius: 5px;
    font-size: 0.9em;
    font-weight: 700;
    vertical-align: baseline;
    line-height: 1.5;
}

.deck-builder-page .db-detail-acq {
    font-size: 0.92rem;
    color: #9aa3b2;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    line-height: 1.45;
}

.deck-builder-page .db-detail-acq strong {
    color: #eef1f6;
    font-weight: 600;
}

.deck-builder-page .db-detail-footer {
    margin-top: auto;
    padding: 12px 14px 14px;
    border-top: 1px solid #2c3340;
    background: #1a1e27;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.deck-builder-page .db-detail-footer-meta {
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex: 1 1 100%;
    min-width: 0;
    margin-bottom: 2px;
}

.deck-builder-page .db-detail-footer-meta .block .label {
    font-size: 0.78rem;
    color: #8b93a3;
    font-weight: 600;
    display: block;
}

.deck-builder-page .db-detail-footer-meta .block .value {
    font-size: 1.15rem;
    font-weight: 700;
    color: #eef1f6;
}

.deck-builder-page .db-detail-footer-meta .value.in-stock { color: #7dcea0; }
.deck-builder-page .db-detail-footer-meta .value.sold-out { color: #e08a8a; }
.deck-builder-page .db-detail-footer-meta .value.price { color: #fbc11c; font-size: 1.28rem; }

.deck-builder-page .db-detail-btn {
    border-radius: 8px;
    font-weight: 650;
    padding: 9px 12px;
    border: 1px solid #2c3340;
    background: #12151c;
    color: #eef1f6;
    font-size: 0.82rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
}

.deck-builder-page .db-detail-btn--primary {
    background: #fbc11c;
    border-color: transparent;
    color: #1a1400;
}

.deck-builder-page .db-detail-btn--cart {
    background: #10b981;
    border-color: transparent;
    color: #fff;
}

.deck-builder-page .db-detail-btn--login {
    background: #fbc11c;
    border-color: transparent;
    color: #1a1400;
}

.deck-builder-page .db-detail-btn--ghost {
    background: transparent;
}

.deck-builder-page .db-detail-btn--disabled,
.deck-builder-page .db-detail-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* modal 內詳情：圖片置中、資料在下方 */
#cardDetailModalContent .db-detail-layout {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#cardDetailModalContent .db-detail-image {
    justify-content: center;
    align-items: center;
    padding: 16px 16px 8px;
}

#cardDetailModalContent .db-detail-image img {
    max-width: min(100%, 260px);
    max-height: min(40vh, 320px);
}

@media (min-width: 768px) {
    #cardDetailModal .modal-dialog {
        max-width: 640px;
    }

    #cardDetailModalContent .db-detail-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    #cardDetailModalContent .db-detail-scroll {
        max-height: min(60vh, 520px);
        padding: 22px 22px 12px;
    }

    #cardDetailModalContent .db-detail-footer {
        padding: 14px 22px 18px;
    }

    #cardDetailModalContent .db-detail-footer-meta {
        flex: 1 1 auto;
        margin-bottom: 0;
    }

    #cardDetailModalContent .db-detail-btn {
        flex: 0 1 auto;
        min-width: 140px;
    }
}

.deck-builder-page .db-bar__deck-btn-text {
    white-space: nowrap;
}

.deck-builder-page .db-bar__actions .db-deck__cards-open-count {
    background: rgba(26, 20, 0, 0.22);
    color: #1a1400;
}

/* —— legacy deck panel leftovers (modal ops still use some) —— */
.deck-builder-page .db-deck__section-title {
    margin: 0 0 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #8b93a3;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.deck-builder-page .card-grid {
    display: grid !important;
    /* 對齊「我的牌組」縮圖比例 */
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)) !important;
    gap: 10px !important;
    max-height: calc(100vh - 240px) !important;
    overflow-y: auto !important;
    width: 100% !important;
}

.deck-builder-page .card-item-wrapper {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    width: 100% !important;
    position: relative;
    background: #12151c;
    border: 1px solid #2c3340;
    border-radius: 10px;
    padding: 6px;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.deck-builder-page .card-item-wrapper:hover {
    border-color: rgba(251, 193, 28, 0.4);
}

.deck-builder-page .card-item-wrapper:has(.card-item-image.selected) {
    border-color: #fbc11c;
    box-shadow:
        0 0 0 2px rgba(251, 193, 28, 0.35),
        0 8px 18px rgba(0, 0, 0, 0.35);
}

.deck-builder-page .card-item-image {
    width: 100% !important;
    background: #0a0c10 !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 0 !important;
    box-shadow: none !important;
    aspect-ratio: 63 / 88;
    overflow: hidden;
}

.deck-builder-page .card-item-image:hover {
    transform: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.deck-builder-page .card-item-image.selected {
    transform: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
    z-index: 1;
    position: relative;
}

.deck-builder-page .card-item-image.selected::after {
    content: "檢視中";
    position: absolute;
    left: 6px;
    top: 6px;
    z-index: 4;
    padding: 2px 7px;
    border-radius: 999px;
    background: #fbc11c;
    color: #1a1400;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.4;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.deck-builder-page .card-item-image.selected .card-image-only {
    filter: brightness(1.06) saturate(1.08);
}

.deck-builder-page .card-image-only {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    border-radius: 0 !important;
}

.deck-builder-page .card-quantity-controls {
    position: static !important;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 6px 4px !important;
    background: rgba(0, 0, 0, 0.28) !important;
    border: none !important;
    border-radius: 6px 6px 0 0 !important;
}

.deck-builder-page .btn-add-to-deck {
    position: static !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 100% !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    background: rgba(251, 193, 28, 0.08) !important;
    border: none !important;
    border-top: 1px solid #2c3340 !important;
    color: #fbc11c !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    padding: 7px 8px !important;
    border-radius: 0 0 6px 6px !important;
}

.deck-builder-page .btn-add-to-deck:hover {
    background: rgba(251, 193, 28, 0.18) !important;
    box-shadow: none !important;
    transform: none !important;
}

.deck-builder-page .quantity-display {
    color: #fbc11c !important;
    min-width: 24px;
    text-align: center;
    font-weight: 700;
}

.deck-builder-page .deck-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 16px;
    color: #8b93a3;
}

.deck-builder-page .deck-empty-state__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(251, 193, 28, 0.14);
    color: #fbc11c;
}

/* —— deck modal shared bits —— */
.deck-builder-page .db-deck__cards-open-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6em;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(26, 20, 0, 0.22);
    color: #1a1400;
    font-weight: 800;
    font-size: 0.8rem;
}

.deck-builder-page #deckContainer.db-deck-list {
    min-height: 140px;
    max-height: none;
    flex: 1;
    overflow: auto;
    border: 1px solid #2c3340;
    border-radius: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.22);
}

.deck-builder-page #deckStats.db-deck-stats {
    padding: 10px;
    border: 1px solid #2c3340;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.15);
    font-size: 0.82rem;
    flex: 1 1 auto;
    overflow: auto;
}

.deck-builder-page .db-deck__ops {
    border-top: 1px solid #2c3340;
    padding: 10px;
    flex-shrink: 0;
    overflow: auto;
    background: #1e232d;
}

/* —— deck cards modal（牌組卡 + 操作） —— */
.deck-builder-page .db-deck-cards-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: rgba(0, 0, 0, 0.72);
}

.deck-builder-page .db-deck-cards-modal {
    position: fixed;
    z-index: 1065;
    inset: 3%;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    transform: none;
    display: flex;
    flex-direction: column;
    background: #171a21;
    border: 1px solid #2c3340;
    border-radius: 12px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.deck-builder-page .db-deck-cards-modal[hidden],
.deck-builder-page .db-deck-cards-backdrop[hidden] {
    display: none !important;
}

.deck-builder-page .db-deck-cards-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #2c3340;
    flex-shrink: 0;
}

.deck-builder-page .db-deck-cards-modal__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

/* 操作列：比照 db-bar 置頂橫排 */
.deck-builder-page .db-deck-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 14px;
    border-bottom: 1px solid #2c3340;
    background: #1a1e27;
    flex-shrink: 0;
}

.deck-builder-page .db-deck-toolbar__left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    min-width: 0;
    flex: 1 1 auto;
}

.deck-builder-page .db-deck-toolbar__name {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 14px;
    border-right: 1px solid #2c3340;
}

.deck-builder-page .db-deck-toolbar__label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #9aa3b2;
    line-height: 1.2;
}

.deck-builder-page .db-deck-toolbar__name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
}

.deck-builder-page .db-deck-toolbar__name-text {
    font-weight: 800;
    font-size: 1.05rem;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #eef1f6;
    line-height: 1.2;
}

.deck-builder-page .db-deck-toolbar__new-btn {
    padding: 0 10px !important;
    min-height: 32px;
    flex-shrink: 0;
}

.deck-builder-page .db-deck-toolbar__toggles {
    display: flex;
    align-items: center;
    min-width: 0;
}

.deck-builder-page .db-deck-toolbar__toggle-group {
    display: inline-flex;
    align-items: stretch;
    flex-wrap: wrap;
    border: 1px solid #2c3340;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
}

.deck-builder-page .db-deck-toolbar__group-label {
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    min-height: 36px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #8b93a3;
    background: rgba(255, 255, 255, 0.03);
    border-right: 1px solid #2c3340;
    white-space: nowrap;
    user-select: none;
    pointer-events: none;
}

.deck-builder-page .db-deck-toolbar .deck-controls-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    margin: 0 !important;
    margin-bottom: 0 !important;
    padding: 7px 14px !important;
    border-radius: 0 !important;
    border: none !important;
    border-right: 1px solid #2c3340 !important;
    background: transparent !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    color: #9aa3b2 !important;
    cursor: pointer;
    white-space: nowrap;
    min-height: 36px;
    transition: background 0.15s, color 0.15s;
}

.deck-builder-page .db-deck-toolbar .deck-controls-toggle .form-check-input {
    position: absolute !important;
    opacity: 0 !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    pointer-events: none !important;
}

.deck-builder-page .db-deck-toolbar .deck-controls-toggle::before {
    content: "";
    box-sizing: border-box;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 1.5px solid #5c6574;
    border-radius: 4px;
    background: #0f131a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    color: #1a1400;
}

.deck-builder-page .db-deck-toolbar .deck-controls-toggle:has(input:checked)::before {
    content: "✓";
    background: #fbc11c;
    border-color: #fbc11c;
}

.deck-builder-page .db-deck-toolbar .deck-controls-toggle:last-child {
    border-right: none !important;
}

.deck-builder-page .db-deck-toolbar .deck-controls-toggle:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #eef1f6 !important;
}

.deck-builder-page .db-deck-toolbar .deck-controls-toggle:has(input:checked) {
    background: rgba(251, 193, 28, 0.14) !important;
    color: #fbc11c !important;
}

.deck-builder-page .db-deck-toolbar .deck-controls-toggle:has(input:focus-visible) {
    box-shadow: inset 0 0 0 2px rgba(251, 193, 28, 0.55);
}

.deck-builder-page .db-deck-toolbar__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.deck-builder-page .db-deck-toolbar__meta-field {
    display: flex;
    align-items: center;
    min-width: 0;
}

.deck-builder-page .db-deck-toolbar__tournament {
    width: 180px;
    min-height: 36px !important;
    height: 36px !important;
    padding: 6px 10px !important;
    font-size: 0.85rem;
    border-radius: 8px !important;
}

.deck-builder-page .db-deck-toolbar__privacy {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #2c3340;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
    min-height: 36px;
}

.deck-builder-page .db-deck-toolbar__privacy-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 0 14px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: #9aa3b2;
    border-right: 1px solid #2c3340;
    transition: background 0.15s, color 0.15s;
}

.deck-builder-page .db-deck-toolbar__privacy-option input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

.deck-builder-page .db-deck-toolbar__privacy-option::before {
    content: "";
    box-sizing: border-box;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 1.5px solid #5c6574;
    border-radius: 50%;
    background: #0f131a;
    box-shadow: inset 0 0 0 0 #fbc11c;
}

.deck-builder-page .db-deck-toolbar__privacy-option:has(input:checked)::before {
    content: "";
    border-color: #fbc11c;
    box-shadow: inset 0 0 0 4px #fbc11c;
    background: #0f131a;
}

.deck-builder-page .db-deck-toolbar__privacy-option:last-child {
    border-right: none;
}

.deck-builder-page .db-deck-toolbar__privacy-option:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #eef1f6;
}

.deck-builder-page .db-deck-toolbar__privacy-option:has(input:checked) {
    background: rgba(251, 193, 28, 0.14);
    color: #fbc11c;
}

.deck-builder-page .db-deck-toolbar__privacy-option:has(input:focus-visible) {
    box-shadow: inset 0 0 0 2px rgba(251, 193, 28, 0.55);
}

.deck-builder-page .db-deck-toolbar__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.deck-builder-page .db-deck-toolbar__actions .deck-action-btn {
    width: auto;
    min-height: 36px;
    padding: 0 12px;
    white-space: nowrap;
    font-size: 0.82rem;
}

.deck-builder-page .db-deck-cards-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    overflow: hidden;
}

.deck-builder-page .db-deck-cards-modal__cards {
    min-width: 0;
    min-height: 0;
    padding: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.deck-builder-page .db-deck-cards-modal__cards #deckContainer.db-deck-list {
    height: 100%;
    max-height: none;
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)) !important;
    grid-auto-rows: max-content !important;
    gap: 12px !important;
    align-items: start !important;
    align-content: start !important;
    justify-items: stretch !important;
    overflow: auto;
    padding: 12px !important;
    box-sizing: border-box;
}

/* 牌組卡圖：強制獨立格子，避免舊 inline-block / 固定高寬造成重疊 */
.deck-builder-page .db-deck-cards-modal #deckContainer .deck-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    position: relative !important;
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 8px !important;
    border-radius: 10px;
    box-sizing: border-box !important;
    vertical-align: top !important;
    transform: none !important;
    overflow: visible !important;
    z-index: 1;
}

.deck-builder-page .db-deck-cards-modal #deckContainer .deck-card:hover {
    transform: none !important;
    z-index: 2;
}

.deck-builder-page .db-deck-cards-modal #deckContainer .deck-card img {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    aspect-ratio: 63 / 88 !important;
    object-fit: contain !important;
    margin: 0 auto !important;
    border-radius: 6px;
}

.deck-builder-page .db-deck-cards-modal #deckContainer .deck-card-image-wrapper {
    width: 100% !important;
    display: block !important;
    position: relative !important;
    flex: 0 0 auto;
}

.deck-builder-page .db-deck-cards-modal #deckContainer .deck-card-count {
    position: relative !important;
    display: flex !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    margin-top: 6px !important;
    width: 100%;
    box-sizing: border-box;
}

.deck-builder-page .db-deck-cards-modal #deckContainer .deck-card-info {
    margin-top: 4px;
    position: relative !important;
}

.deck-builder-page .db-deck-cards-modal #deckContainer .deck-card-id,
.deck-builder-page .db-deck-cards-modal #deckContainer .deck-card-name {
    font-size: 0.72rem !important;
    line-height: 1.25;
}

.deck-builder-page .db-deck-cards-modal #deckContainer .deck-card-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.deck-builder-page .db-deck-cards-modal__rail {
    min-width: 0;
    min-height: 0;
    border-left: 1px solid #2c3340;
    background: #1a1e27;
    display: flex;
    flex-direction: column;
}

.deck-builder-page .db-deck-cards-modal__rail-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.deck-builder-page .db-deck-panel {
    padding: 10px;
    border: 1px solid #2c3340;
    border-radius: 10px;
    background: #171a21;
}

.deck-builder-page .db-deck-cards-modal .db-deck__ops.db-deck-toolbar {
    border: none;
    border-radius: 0;
    padding: 10px 12px;
    background: #1a1e27;
    max-height: none;
    height: auto;
    overflow: visible;
}

.deck-builder-page .db-deck-box {
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    border: 1px solid var(--db-line);
}

.deck-builder-page .db-deck-box__label {
    color: var(--db-muted);
    font-size: 0.75rem;
    margin: 0 0 4px;
    display: block;
}

.deck-builder-page .db-deck-box--row {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.deck-builder-page #deckStats.db-deck-stats {
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 0.82rem;
    flex: none;
    overflow: visible;
}

.deck-builder-page .db-stat-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.deck-builder-page .db-stat-summary__item {
    padding: 10px 8px;
    border-radius: 8px;
    background: rgba(251, 193, 28, 0.08);
    border: 1px solid rgba(251, 193, 28, 0.22);
    text-align: center;
}

.deck-builder-page .db-stat-summary__label {
    display: block;
    font-size: 0.7rem;
    color: #9aa3b2;
    margin-bottom: 4px;
}

.deck-builder-page .db-stat-summary__value {
    font-size: 1.35rem;
    font-weight: 800;
    color: #fbc11c;
    line-height: 1;
}

.deck-builder-page .db-stat-summary__unit {
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 2px;
    color: #c8b06a;
}

.deck-builder-page .db-stat-block {
    margin-top: 8px;
}

.deck-builder-page .db-stat-section {
    margin-top: 8px;
}

.deck-builder-page .db-stat-section__title {
    margin: 0 0 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #c5ccd8;
}

.deck-builder-page .db-stat-section__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.deck-builder-page .db-stat-section__row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.78rem;
}

.deck-builder-page .db-stat-section__row span:last-child {
    color: #fbc11c;
    font-weight: 700;
    white-space: nowrap;
}

.deck-builder-page .deck-cover-hint {
    margin: 10px 0 0;
    font-size: 0.72rem;
    color: var(--db-muted);
    line-height: 1.4;
}

body.db-deck-cards-open {
    overflow: hidden;
}

@media (min-width: 1400px) {
    .deck-builder-page .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)) !important;
        gap: 12px !important;
    }

    .deck-builder-page .db-deck-cards-modal__cards #deckContainer.db-deck-list {
        grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)) !important;
        gap: 12px !important;
    }

    .deck-builder-page .db-deck-cards-modal__body {
        grid-template-columns: minmax(0, 1fr) 300px;
    }
}

@media (max-width: 899.98px) {
    .deck-builder-page .db-deck-cards-modal {
        inset: 0;
        border-radius: 0;
    }

    .deck-builder-page .db-deck-toolbar {
        max-height: 42vh;
        overflow: auto;
        align-items: flex-start;
    }

    .deck-builder-page .db-deck-toolbar__actions {
        width: 100%;
        justify-content: flex-start;
    }

    .deck-builder-page .db-deck-cards-modal__body {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) minmax(180px, 34%);
    }

    .deck-builder-page .db-deck-cards-modal__rail {
        border-left: none;
        border-top: 1px solid #2c3340;
    }

    .deck-builder-page .db-deck-cards-modal__cards #deckContainer.db-deck-list {
        grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)) !important;
        gap: 10px !important;
        padding: 10px !important;
    }
}

.deck-builder-page .deck-action-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.deck-builder-page .deck-action-btn {
    width: 100%;
    min-height: 38px;
    border: 1px solid #2c3340;
    border-radius: 8px;
    background: #171a21;
    color: #eef1f6;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.deck-builder-page .deck-action-btn--primary {
    background: #fbc11c !important;
    color: #1a1400 !important;
    border-color: transparent !important;
}

.deck-builder-page .deck-action-btn--success {
    border-color: rgba(63, 157, 110, 0.45);
    color: #7dcea0;
}

.deck-builder-page .deck-action-btn--danger {
    border-color: rgba(196, 87, 87, 0.4);
    color: #e08a8a;
}

.deck-builder-page .db-deck-backdrop {
    display: none !important;
}

.deck-builder-page .db-sticky {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: rgba(15, 17, 21, 0.95);
    border-top: 1px solid #2c3340;
    gap: 8px;
}

.deck-builder-page .db-sticky .db-btn {
    flex: 1;
}

@media (max-width: 1199.98px) {
    .deck-builder-page .db-workspace {
        grid-template-columns: 1fr !important;
    }

    .deck-builder-page .db-detail {
        display: none !important;
    }

    .deck-builder-page .db-sticky {
        display: flex;
    }

    .deck-builder-page .card-grid {
        max-height: none !important;
    }

    .deck-builder-page .db-bar__deck-btn-text {
        display: none;
    }
}

@media (max-width: 576px) {
    .deck-builder-page .db-bar__meters {
        width: 100%;
    }

    .deck-builder-page .db-meter {
        flex: 1;
        min-width: 0;
    }

    .deck-builder-page .db-meter__track {
        min-width: 0;
    }

    .deck-builder-page .db-filter-field--actions {
        margin-left: 0;
        width: 100% !important;
    }

    .deck-builder-page .db-browse {
        padding: 10px;
    }

    .deck-builder-page .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)) !important;
        gap: 6px !important;
    }
}
