.deck-list-open-btn {
    position: absolute;
    right: clamp(18px, 4vw, 48px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 4;
    padding: 12px 18px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(17, 24, 39, 0.78);
    color: #fff;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
}

.deck-list-open-btn:hover {
    background: rgba(17, 24, 39, 0.94);
    transform: translateY(calc(-50% - 2px));
}

.deck-list-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 3vw, 36px);
    background: rgba(10, 14, 28, 0.62);
}

.deck-list-overlay.hidden {
    display: none;
}

.deck-list-modal {
    width: min(1160px, 96vw);
    height: min(860px, 96vh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.98);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
    color: #111827;
}

.deck-list-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 40px;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid #d7dce5;
    background: #111827;
    color: #fff;
}

.deck-list-eyebrow {
    margin: 0 0 3px 0;
    color: #a8b3c7;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.deck-list-header h2 {
    margin: 0;
    font-size: 1.45rem;
}

.deck-list-summary {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
    font-weight: 700;
    white-space: nowrap;
}

.deck-list-close-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    font-size: 1.6rem;
    line-height: 1;
}

.deck-list-close-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.deck-list-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 20px 0;
    background: #f8fafc;
}

.deck-list-tab {
    min-width: 112px;
    padding: 8px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #fff;
    color: #475569;
    cursor: pointer;
    font-weight: 800;
}

.deck-list-tab:hover {
    border-color: #94a3b8;
    color: #1f2937;
}

.deck-list-tab.is-active {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.deck-list-body {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 20px;
}

.deck-list-main {
    min-height: 100%;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        "preview grid"
        "detail grid";
    align-items: start;
    gap: 16px;
}

.deck-list-grid-panel {
    grid-area: grid;
    min-width: 0;
    align-self: start;
}

.deck-list-grid {
    display: grid;
    grid-template-columns: repeat(7, 76px);
    justify-content: center;
    gap: 10px 9px;
}

.deck-list-card {
    width: 76px;
    height: 108px;
    min-width: 0;
    position: relative;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.deck-list-card .cg-card {
    cursor: pointer;
}

.deck-list-card.active .cg-card-shell {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

.deck-list-card:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 4px;
    border-radius: 8px;
}

.deck-list-card-meta {
    width: calc(100% - 10px);
    display: flex;
    justify-content: center;
    gap: 0;
    position: absolute;
    left: 50%;
    bottom: 3px;
    transform: translateX(-50%);
    z-index: 2;
    padding: 1px 4px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: #f8fafc;
    font-size: 0.56rem;
    font-weight: 700;
    line-height: 1.2;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.deck-list-card-id,
.deck-list-card-rarity {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deck-list-card-rarity {
    display: none;
}

.deck-list-empty {
    margin: 36px 0;
    color: #475569;
    font-weight: 700;
    text-align: center;
}

.deck-list-detail {
    grid-area: detail;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    align-self: end;
    padding: 14px;
    border: 2px solid #3498db;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
}

.deck-list-preview {
    grid-area: preview;
    width: 100%;
    min-height: 334px;
    align-self: start;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(255, 251, 235, 0.94), rgba(248, 250, 252, 0.96));
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}

.deck-list-preview-empty {
    margin: auto 0;
    color: #64748b;
    font-weight: 800;
    line-height: 1.6;
    text-align: center;
}

.deck-list-preview-card-frame {
    display: grid;
    place-items: center;
    padding: 6px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 12px;
    background:
        radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.92), rgba(226, 232, 240, 0.64));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.75),
        0 10px 26px rgba(15, 23, 42, 0.18);
}

.deck-list-preview-card {
    cursor: default;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.24);
}

.deck-list-preview-card-fallback {
    width: 214px;
    height: 304px;
    display: grid;
    place-items: center;
    border: 2px solid #2563eb;
    border-radius: 12px;
    background: #fff;
    color: #1f2937;
    font-weight: 900;
    text-align: center;
}

.deck-list-detail-empty {
    margin: 0;
    color: #64748b;
    font-weight: 700;
    line-height: 1.6;
}

.deck-list-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #d7dce5;
}

.deck-list-detail-header h3 {
    flex: 1;
    margin: 0;
    color: #2c3e50;
    font-size: 1.05rem;
    line-height: 1.25;
}

.deck-list-detail-back {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(37, 99, 235, 0.26);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: #1d4ed8;
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.deck-list-detail-back:hover,
.deck-list-detail-back:focus-visible {
    background: rgba(219, 234, 254, 0.94);
    border-color: rgba(37, 99, 235, 0.5);
    outline: none;
}

.deck-list-detail-section + .deck-list-detail-section {
    margin-top: 10px;
}

.deck-list-detail-section h4 {
    margin: 0 0 5px;
    color: #34495e;
    font-size: 0.86rem;
}

.deck-list-detail-section p {
    margin: 0;
    color: #475569;
    font-size: 0.8rem;
    line-height: 1.55;
}

.deck-list-detail-section.fusion-lines p {
    white-space: pre-line;
}

.deck-list-slot-section .deck-list-effect-slots {
    gap: 6px;
}

.deck-list-detail .deck-list-effect-slot {
    padding: 6px 7px 7px;
    border-radius: 8px;
}

.deck-list-detail .deck-list-effect-slot-conditional {
    border-color: rgba(14, 165, 233, 0.30);
    background:
        linear-gradient(180deg, rgba(239, 246, 255, 0.88), rgba(224, 242, 254, 0.68));
}

.deck-list-detail .card-effect-slot-meta {
    gap: 3px;
    margin-bottom: 4px;
}

.deck-list-detail .card-effect-slot-badge {
    min-height: 16px;
    padding: 1px 5px;
    font-size: 0.66rem;
}

.deck-list-detail .card-effect-slot-body {
    font-size: 0.76rem;
    line-height: 1.42;
}

.deck-list-detail .rarity-badge.special {
    background: #e11d48;
}

.deck-list-detail .rarity-badge.fusion {
    background: #f97316;
}

.deck-list-note {
    margin: 18px 0 0;
    color: #64748b;
    font-size: 0.9rem;
    text-align: center;
}

@media (max-width: 900px) {
    .deck-list-open-btn {
        top: auto;
        right: 20px;
        bottom: 20px;
        transform: none;
    }

    .deck-list-open-btn:hover {
        transform: translateY(-2px);
    }

    .deck-list-modal {
        height: 94vh;
    }

    .deck-list-header {
        grid-template-columns: minmax(0, 1fr) 40px;
    }

    .deck-list-summary {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .deck-list-main {
        grid-template-columns: 1fr;
        grid-template-areas:
            "preview"
            "detail"
            "grid";
        align-items: start;
    }

    .deck-list-detail {
        max-height: 220px;
    }

    .deck-list-preview {
        position: static;
        min-height: auto;
    }

    .deck-list-grid {
        grid-template-columns: repeat(auto-fit, 76px);
    }
}
