/* =========================================================
   Global Layout
========================================================= */

.background {
    width: 100%;
    padding: 10px;
    border: 8px solid black;
    background-image: linear-gradient(
        to right,
        lightgrey,
        grey,
        grey,
        grey,
        grey,
        grey,
        lightgrey
    );
    transition: width 0.7s ease, margin-left 0.7s ease;
}

#HeadBanner {
    display: block;
    width: 600px;
    max-width: 100%;
    height: auto;
    margin: 25px auto 15px;
}

.cardImages:hover {
    cursor: pointer;
    opacity: 0.85;
}

input[type="radio"] {
    cursor: pointer;
}

input {
    margin: 0.4rem;
}

fieldset {
    border: 3px solid black;
}

legend {
    padding: 3px 6px;
    color: white;
    background-color: black;
}

.output {
    font: 1rem "Calibri", sans-serif;
}


/* =========================================================
   Main Navigation
========================================================= */

#mainNavbar {
    position: relative;
    z-index: 2000;
    width: 100%;
    margin-left: 0;
    transition: width 0.5s ease, margin-left 0.5s ease;
}

#mainNavbar .navbar-collapse {
    position: relative;
    z-index: 2001;
}

.navbar-user-area {
    width: auto;
}

.navbar-search-form {
    min-width: 280px;
}


/* =========================================================
   Overlays
========================================================= */

.overlay {
    position: fixed;
    top: 0;
    z-index: 1;
    width: 0;
    height: 100%;
    overflow-x: hidden;
    background-color: rgba(0, 0, 0, 0.9);
    transition: width 0.7s ease;
}

#zoom {
    right: 0;
}

@media (max-width: 991.98px) {
    #deck.overlay {
        position: fixed;
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;

        width: 100% !important;
        height: 78vh;

        visibility: hidden;
        pointer-events: none;

        transform: translateY(100%);
        transition:
            transform 0.3s ease,
            visibility 0s linear 0.3s;
    }

    #deck.overlay.mobile-deck-open {
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);

        transition:
            transform 0.3s ease,
            visibility 0s;
    }
}

.overlay-content {
    position: relative;
    width: 100%;
    margin-top: 2.5%;
    margin-bottom: 2.5%;
    text-align: center;
}

.overlay a {
    display: block;
    padding: 8px;
    color: #818181;
    font-size: 36px;
    text-decoration: none;
    transition: color 0.5s ease;
}

.overlay a:hover,
.overlay a:focus {
    color: #f1f1f1;
}

@media (max-width: 991.98px) {
    #zoom.card-preview-open .preview-close-button {
        position: fixed;
        top: 4px;
        right: 16px;
        z-index: 5002;
        padding: 0;
        color: white;
        font-size: 54px;
        line-height: 1;
    }
}

.overlay .addbtn {
    position: absolute;
    top: 60px;
    right: 25px;
    z-index: 2;
    font-size: 50px;
}

.overlay .delbtn {
    position: absolute;
    left: 10%;
    z-index: 3;
    font-size: 20px;
}

#cards,
#value {
    color: #f1f1f1;
    text-align: center;
}

#cards {
    position: relative;
    margin-top: 22px;
    padding-bottom: 10px;
    font-size: 20pt;
}

#value {
    font-size: 30pt;
}

@media screen and (max-width: 3200px) {
    .overlayImages {
        width: 32%;
    }
}

@media screen and (max-width: 1750px) {
    .overlayImages {
        width: 590px;
        max-width: 100%;
    }
}

@media screen and (max-width: 900px) {
    .overlayImages {
        width: 450px;
        max-width: 100%;
    }
}


/* =========================================================
   Deck Sidebar
========================================================= */

.deck-sidebar-eyebrow {
    display: block;
    margin-top: 22px;
    color: #aaa;
    font-size: 12px;
    letter-spacing: 1.4px;
    text-align: center;
    text-transform: uppercase;
}

.deck-sidebar-title {
    margin: 8px 15px;
    overflow-wrap: anywhere;
    color: white;
    font-size: 26px;
    font-weight: bold;
    text-align: center;
}

.deck-sidebar-description {
    margin: 0 15px 18px;
    color: #ccc;
    text-align: center;
}

.deck-toolbar {
    display: flex;
    justify-content: center;
    width: 90%;
    margin: 10px auto 12px;
    gap: 10px;
}

.deck-toolbar .btn {
    flex: 1;
    white-space: nowrap;
}


/* =========================================================
   Active Deck Banner
========================================================= */

.active-deck-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    width: min(1400px, 94%);
    margin: 20px auto;
    padding: 18px 22px;
    gap: 18px;
    color: white;
    border: 1px solid #555;
    border-radius: 12px;
    background: linear-gradient(135deg, #171717, #292929);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.35);
}

.temporary-deck-banner {
    border-color: #3d8f52;
}

.active-deck-banner-title h1 {
    margin: 3px 0 0;
    font-size: 28px;
}

.active-deck-label {
    display: block;
    color: #bbb;
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.active-deck-banner-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.active-deck-banner-meta > span {
    padding: 7px 11px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    font-weight: bold;
}


/* =========================================================
   My Decks Dashboard
========================================================= */

.my-decks-page {
    width: min(1400px, 94%);
    margin: 30px auto;
    padding: 20px;
}

.my-decks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    gap: 20px;
}

.my-decks-header h1 {
    margin: 0;
}

.my-decks-subtitle {
    margin: 5px 0 0;
    opacity: 0.7;
}

.new-deck-button {
    min-width: 150px;
    font-weight: bold;
}

.deck-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    align-items: start;
    gap: 24px;
}

.saved-deck-card {
    width: 100%;
    max-width: 460px;
    justify-self: center;
    overflow: hidden;
    color: white;
    border: 1px solid #3c3c3c;
    border-radius: 14px;
    background: #171717;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.saved-deck-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.deck-cover-link {
    display: block;
    padding: 20px;
    text-align: center;
    background: radial-gradient(circle at center, #333, #111);
}

.deck-cover-crop {
    width: min(320px, 92%);
    height: 190px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.6);
}

.deck-cover-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.deck-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 280px;
    color: #aaa;
    font-size: 18px;
}

.deck-card-body {
    padding: 20px;
}

.deck-card-title {
    margin: 0 0 12px;
    font-size: 26px;
    text-align: center;
}

.deck-card-title a {
    color: white;
    text-decoration: none;
}

.deck-card-title a:hover {
    text-decoration: underline;
}

.deck-summary {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
    gap: 12px;
}

.deck-summary span {
    padding: 6px 10px;
    border-radius: 20px;
    background: #2a2a2a;
    font-weight: bold;
}

.deck-valid-status,
.deck-incomplete-status,
.deck-invalid-status {
    margin: 12px 0;
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
}

.deck-valid-status {
    color: #b9ffca;
    border: 1px solid #318b4a;
    background: rgba(28, 135, 61, 0.25);
}

.deck-incomplete-status {
    color: #ffe6a8;
    border: 1px solid #bd8c2e;
    background: rgba(170, 120, 20, 0.25);
}

.deck-invalid-status {
    color: #ffd0d0;
    border: 1px solid #ad4545;
    background: rgba(170, 40, 40, 0.25);
}

.deck-validation-list {
    margin: 10px 0;
    padding-left: 22px;
    color: #ffb8b8;
}

.deck-incomplete-list {
    color: #ffe0a0;
}

.deck-statistics {
    margin: 18px 0;
    padding: 12px;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    background: #202020;
}

.deck-statistics summary {
    cursor: pointer;
    font-weight: bold;
    text-align: center;
}

.deck-stat-section {
    margin-top: 25px;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 10px;
    background:
        linear-gradient(
            90deg,
            #2d6fd3,
            #61b2ff
        );
    box-shadow:
        0 0 10px rgba(65,150,255,.45);
    transition:
        width .35s ease;
}

.deck-analysis-summary {
    display: block;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255,255,255,.03);
    transition: .2s;
    text-align: center;
    font-weight: bold;
    font-size: 17px;
}

.deck-analysis-summary:hover {
    background: rgba(45,111,211,.15);
    color: #7ab7ff;
}

.deck-analysis-title {
    margin-top: 8px;
    margin-bottom: 10px;
    text-align: center;
    color: white;
    font-size: 26px;
    font-weight: bold;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.deck-stat-section h3 {
    position: relative;
    margin: 34px 0 20px;
    text-align: center;
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.deck-stat-section h3::before,
.deck-stat-section h3::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 28%;
    height: 2px;
    background: linear-gradient(
        to right,
        transparent,
        #2d6fd3
    );
}

.deck-stat-section h3::before {
    left: 0;
}

.deck-stat-section h3::after {
    right: 0;
    transform: scaleX(-1);
}

.stat-row {
    display: grid;
    grid-template-columns: 85px 1fr 30px;
    align-items: center;
    margin: 7px 0;
    gap: 8px;
}

.stat-label {
    font-weight: bold;
}

.stat-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-bar-track {
    height: 12px;
    overflow: hidden;
    border-radius: 10px;
    background: #404040;
}

.stat-bar-fill {
    min-width: 0;
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, #2375cf, #63b5ff);
}

.stat-count {
    font-weight: bold;
    text-align: right;
}

.deck-updated-date {
    margin: 14px 0;
    color: #aaa;
    font-size: 13px;
    text-align: center;
}


/* =========================================================
   Deck Actions
========================================================= */

.deck-action-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
    gap: 8px;
}

.deck-action-row form {
    display: inline-block;
    width: auto;
    margin: 0;
}

.deck-action-row .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 82px;
    height: 38px;
    padding: 6px 10px;
    font-size: 14px;
}

.rename-deck-form {
    display: flex;
    width: 100%;
    margin: 12px auto 0;
    gap: 8px;
}

.rename-deck-form input,
.rename-deck-form .form-control {
    min-width: 0;
}

.deck-cover-picker {
    width: 100%;
    margin: 12px auto 0;
}

.deck-cover-picker label {
    display: block;
    margin-bottom: 6px;
    color: #ddd;
    font-weight: bold;
}


/* =========================================================
   Empty State
========================================================= */

.empty-decks-state {
    padding: 60px 20px;
    border: 1px solid #ccc;
    border-radius: 12px;
    text-align: center;
}


/* =========================================================
   Responsive
========================================================= */

@media (max-width: 991.98px) {
    #mainNavbar {
        width: 100% !important;
        margin-left: 0 !important;
    }

    #mainNavbar .navbar-collapse {
        margin-top: 12px;
        padding: 14px;
        border-top: 1px solid #ddd;
        background: #f8f9fa;
    }

    #mainNavbar .navbar-nav {
        margin-bottom: 14px !important;
    }

    #mainNavbar .nav-link {
        padding: 10px 8px;
        font-size: 18px;
        text-align: center;
    }

    .navbar-user-area,
    .navbar-user-area > a,
    .navbar-user-area > form,
    .navbar-user-area .btn {
        width: 100%;
    }

    .navbar-search-form {
        width: 100%;
        min-width: 0;
        margin-top: 8px !important;
    }

    .navbar-search-form .form-control,
    .navbar-search-form .btn {
        width: 100%;
    }
}

@media (max-width: 767px) {
    .active-deck-banner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .active-deck-banner-meta {
        justify-content: center;
    }

    .active-deck-banner-meta .btn {
        width: 100%;
    }

    .deck-toolbar {
        flex-direction: column;
    }

    .deck-toolbar .btn {
        width: 100%;
    }
}

@media (max-width: 650px) {
    .my-decks-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

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

    .rename-deck-form {
        flex-direction: column;
    }

    .stat-row {
        grid-template-columns: 75px 1fr 30px;
    }
}




/* =========================================================
   Deck Builder Controls and Statistics
========================================================= */

.deck-builder-panel {
    width: min(1000px, 92%);
    margin: 12px auto 20px;
    padding: 18px;
    color: white;
    border: 1px solid #555;
    border-radius: 12px;
    background: #202020;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.deck-builder-rename-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.deck-builder-form-row {
    display: flex;
    gap: 10px;
}

.deck-builder-form-row .form-control {
    min-width: 0;
    margin: 0;
}

.deck-builder-stats h2 {
    margin-top: 0;
    text-align: center;
}

.deck-builder-stats h3 {
    margin-top: 22px;
    font-size: 18px;
}

.builder-stat-summary {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.builder-stat-summary span {
    padding: 7px 11px;
    border-radius: 20px;
    background: #333;
    font-weight: bold;
}

.builder-stat-row {
    display: grid;
    grid-template-columns: 35px 1fr 35px;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

.builder-stat-label,
.builder-stat-count {
    font-weight: bold;
}

.builder-stat-count {
    text-align: right;
}

.builder-stat-track {
    height: 13px;
    overflow: hidden;
    border-radius: 10px;
    background: #444;
}

.builder-stat-fill {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(
        90deg,
        #2375cf,
        #63b5ff
    );
    transition: width 0.25s ease;
}

.builder-status-valid,
.builder-status-incomplete {
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
}

.builder-status-valid {
    color: #b9ffca;
    border: 1px solid #318b4a;
    background: rgba(28, 135, 61, 0.25);
}

.builder-status-incomplete {
    color: #ffe6a8;
    border: 1px solid #bd8c2e;
    background: rgba(170, 120, 20, 0.25);
}

@media (max-width: 650px) {
    .deck-builder-form-row {
        flex-direction: column;
    }
}

/* =========================================================
   Saved Deck Editor Banner
========================================================= */

.active-deck-banner {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: center;
    width: min(1400px, 94%);
    margin: 20px auto;
    padding: 22px 26px;
    gap: 28px;
    color: white;
    border: 1px solid #555;
    border-radius: 12px;
    background: linear-gradient(
        135deg,
        #171717,
        #292929
    );
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.35);
}

.active-deck-banner-title {
    min-width: 0;
}

.active-deck-banner-title h1 {
    margin: 3px 0 4px;
    overflow-wrap: anywhere;
    font-size: 30px;
    line-height: 1.15;
}

.active-deck-label {
    display: block;
    color: #bbb;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.active-deck-description {
    margin: 0;
    color: #ccc;
    font-size: 14px;
}

.active-deck-banner-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 14px;
}

.active-deck-banner-stats {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 9px;
}

.active-deck-banner-stats > span {
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    font-weight: bold;
    white-space: nowrap;
}

.deck-save-status {
    color: #d9f7df;
}

.active-deck-banner-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 9px;
}

.active-deck-banner-actions .btn {
    min-width: 105px;
}

@media (max-width: 900px) {
    .active-deck-banner {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .active-deck-banner-right {
        align-items: stretch;
    }

    .active-deck-banner-stats,
    .active-deck-banner-actions {
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .active-deck-banner-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .active-deck-banner-actions .btn {
        width: 100%;
        min-width: 0;
    }
}

.deck-builder-stats {
    width: min(700px, 100%);
    margin: 0 auto;
}

.deck-builder-stats .stat-row {
    grid-template-columns: 110px 1fr 35px;
}

@media (max-width: 600px) {
    .deck-builder-stats .stat-row {
        grid-template-columns: 80px 1fr 30px;
    }

    .deck-stat-section h3::before,
    .deck-stat-section h3::after {
        width: 20%;
    }
}

/* =========================================================
   Advanced Card Search
========================================================= */

.advanced-search-panel {
    width: min(1100px, 92%);
    margin: 28px auto;
    overflow: hidden;
    color: white;
    border: 1px solid #555;
    border-radius: 14px;
    background: linear-gradient(
        135deg,
        #171717,
        #252525
    );
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.advanced-search-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    gap: 20px;
}

.advanced-search-eyebrow {
    display: block;
    margin-bottom: 3px;
    color: #aaa;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1.6px;
    text-transform: uppercase;
}

.advanced-search-heading h2 {
    margin: 0;
    font-size: 27px;
    letter-spacing: 1px;
}

.advanced-search-heading p {
    margin: 5px 0 0;
    color: #bbb;
    font-size: 14px;
}

.advanced-search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 115px;
    padding: 9px 15px;
    gap: 9px;
    color: white;
    border: 1px solid #777;
    border-radius: 8px;
    background: transparent;
    font-weight: bold;
    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease;
}

.advanced-search-toggle:hover {
    color: #8bc5ff;
    border-color: #4e91df;
    background: rgba(45, 111, 211, 0.15);
}

.advanced-search-toggle[aria-expanded="true"]
    .advanced-search-chevron {
    transform: rotate(180deg);
}

.advanced-search-chevron {
    display: inline-block;
    font-size: 11px;
    transition: transform 0.2s ease;
}

.advanced-search-content {
    padding: 4px 24px 24px;
    border-top: 1px solid #444;
}

.search-filter-section {
    margin-top: 25px;
}

.search-filter-section h3 {
    position: relative;
    margin: 0 0 18px;
    color: white;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 1.5px;
    text-align: center;
    text-transform: uppercase;
}

.search-filter-section h3::before,
.search-filter-section h3::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 29%;
    height: 2px;
    background: linear-gradient(
        to right,
        transparent,
        #2d6fd3
    );
}

.search-filter-section h3::before {
    left: 0;
}

.search-filter-section h3::after {
    right: 0;
    transform: scaleX(-1);
}

.search-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 15px;
}

.search-section-heading h3 {
    flex: 1;
    margin: 0;
}

.search-match-toggle {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.search-match-toggle label {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 5px 9px;
    gap: 5px;
    color: #ccc;
    border-radius: 999px;
    background: #333;
    cursor: pointer;
    font-size: 12px;
}

.search-match-toggle input {
    margin: 0;
}

.search-text-grid,
.search-sort-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.search-text-grid label,
.search-sort-grid label > span {
    display: block;
    margin-bottom: 6px;
    color: #ddd;
    font-weight: bold;
}

.advanced-search-panel .form-control,
.advanced-search-panel .form-select {
    margin: 0;
    color: white;
    border: 1px solid #555;
    background-color: #292929;
}

.advanced-search-panel .form-control::placeholder {
    color: #999;
}

.advanced-search-panel .form-control:focus,
.advanced-search-panel .form-select:focus {
    border-color: #4c91dd;
    box-shadow: 0 0 0 3px rgba(45, 111, 211, 0.2);
}

.advanced-search-panel .form-select option {
    color: white;
    background: #292929;
}

.search-option-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 9px;
}

@media (max-width: 1100px) {
    .search-option-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 900px) {
    .search-option-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 650px) {
    .search-option-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.search-cost-grid {
    grid-template-columns: repeat(
        auto-fit,
        minmax(120px, 1fr)
    );
}

.search-option-chip {
    position: relative;
    display: block;
    margin: 0;
    cursor: pointer;
}

.search-option-chip input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

.search-option-chip span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 11px;
    color: #ddd;
    border: 1px solid #505050;
    border-radius: 8px;
    background: #292929;
    font-weight: 600;
    text-align: center;
    transition:
        color 0.15s ease,
        border-color 0.15s ease,
        background 0.15s ease,
        box-shadow 0.15s ease;
}

.search-option-chip:hover span {
    color: white;
    border-color: #777;
    background: #333;
}

.search-option-chip input:checked + span {
    color: white;
    border-color: #4a91e0;
    background: rgba(45, 111, 211, 0.4);
    box-shadow:
        0 0 10px rgba(65, 150, 255, 0.25);
}

.search-option-chip input:focus-visible + span {
    outline: 2px solid #72b4ff;
    outline-offset: 2px;
}

.search-reverse-toggle {
    display: flex;
    align-items: center;
    align-self: end;
    min-height: 38px;
    margin: 0;
    padding: 7px 12px;
    gap: 8px;
    border: 1px solid #555;
    border-radius: 8px;
    background: #292929;
    cursor: pointer;
}

.search-reverse-toggle input {
    margin: 0;
}

.search-reverse-toggle span {
    margin: 0 !important;
}

.advanced-search-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 28px;
    gap: 10px;
}

.advanced-search-actions .btn {
    min-width: 135px;
}

@media (max-width: 767px) {
    .advanced-search-heading {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .advanced-search-toggle {
        width: 100%;
    }

    .search-section-heading {
        flex-direction: column;
    }

    .search-match-toggle {
        justify-content: center;
    }

    .search-text-grid,
    .search-sort-grid {
        grid-template-columns: 1fr;
    }

    .search-filter-section h3::before,
    .search-filter-section h3::after {
        width: 20%;
    }

    .advanced-search-actions {
        flex-direction: column-reverse;
    }

    .advanced-search-actions .btn {
        width: 100%;
    }
}

/* =========================================================
   Mobile Card Browsing and Deck Drawer
========================================================= */

.card-browser-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin: 5px;
    vertical-align: top;
}

.mobile-add-card-button,
.mobile-deck-bar {
    display: none;
}

@media (max-width: 991.98px) {

    .mobile-deck-bar {
        min-height: 86px;
        padding: 12px 16px;

        display: flex;
        flex-direction: column;
        justify-content: center;

        border-top: 2px solid #444;
        background: rgba(18,18,18,.97);
    }

    .mobile-deck-title {
        font-size: 1rem;
        font-weight: 700;
        margin-bottom: 6px;
    }

    .mobile-deck-stats {
        display: flex;
        justify-content: space-between;
        align-items: center;

        font-size: .95rem;
        font-weight: 600;
    }
}

.mobile-card-toast {
    position: fixed;
    right: 16px;
    bottom: 88px;
    left: 16px;
    z-index: 5000;
    padding: 12px 16px;
    color: white;
    border: 1px solid #3d8f52;
    border-radius: 10px;
    background: rgba(20, 90, 45, 0.96);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    font-weight: bold;
    text-align: center;
    opacity: 0;
    transform: translateY(12px);
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

.mobile-card-toast-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 991.98px) {
    body {
        padding-bottom: 0;
    }

    body.mobile-deck-bar-visible {
        padding-bottom: 105px;
    }

    .card-browser-item {
        width: min(46%, 220px);
        margin: 5px 1%;
    }

    .card-browser-item .cardImages {
        height: auto;
        margin: 0 !important;
    }

    .mobile-add-card-button {
        display: block;
        width: 100%;
        margin-top: 7px;
        padding: 9px 8px;
        border-radius: 8px;
        font-weight: bold;
    }

    .mobile-deck-bar {
        position: fixed;
        right: 10px;
        bottom: 10px;
        left: 10px;
        z-index: 3500;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        align-items: center;
        padding: 10px 14px;
        gap: 12px;
        color: white;
        border: 1px solid #4f92df;
        border-radius: 12px;
        background: rgba(18, 25, 35, 0.97);
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
        text-align: left;
    }

    .mobile-deck-bar[hidden] {
        display: none;
    }

    .mobile-deck-bar-title {
        overflow: hidden;
        font-weight: bold;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-deck-bar-stats {
        display: flex;
        gap: 7px;
        font-size: 13px;
    }

    .mobile-deck-bar-stats span {
        padding: 4px 7px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.1);
    }

    .mobile-deck-bar-action {
        color: #8bc5ff;
        font-size: 13px;
        font-weight: bold;
        white-space: nowrap;
    }

    #deck.overlay {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 4000;
        width: 0;
        height: 72vh;
        border-top: 1px solid #666;
        border-radius: 18px 18px 0 0;
        background: rgba(0, 0, 0, 0.97);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6);
    }

    #deck #cards {
        margin-top: 15px;
        padding-bottom: 25px;
    }

    #deck #value {
        font-size: 22px !important;
    }
}

@media (max-width: 991.98px) {
    #zoom.overlay {
        z-index: 4500;
        width: 0;
        height: 100%;
        padding-top: 55px;
        overflow-y: auto;
    }

    #zoom .overlay-content {
        margin: 0;
        padding: 15px;
    }

    #zoom .overlayImages {
        width: min(92vw, 480px);
        height: auto;
    }

    #zoom .addbtn {
        top: 5px;
        right: 70px;
        padding: 0;
        font-size: 46px;
    }
}

/* =========================================================
   Mobile Full-Screen Card Preview
========================================================= */

@media (max-width: 991.98px) {
    #zoom.overlay {
        position: fixed;
        inset: 0;
        z-index: 5000;
        width: 0;
        height: 100%;
        padding-top: 64px;
        overflow-x: hidden;
        overflow-y: auto;
        background: rgba(0, 0, 0, 0.98);
    }

    #zoom .overlay-content {
        width: 100%;
        margin: 0;
        padding: 12px 12px 100px;
        text-align: center;
    }

    #zoom .overlayImages {
        display: block;
        width: min(94vw, 520px);
        max-width: none;
        height: auto;
        margin: 0 auto 14px;
    }

    #zoom .closebtn {
        position: fixed;
        top: 4px;
        right: 16px;
        z-index: 5002;
        padding: 0;
        color: white;
        font-size: 54px;
        line-height: 1;
    }

    #zoom .addbtn {
        position: fixed;
        top: 4px;
        right: 78px;
        z-index: 5002;
        padding: 0;
        color: white;
        font-size: 54px;
        line-height: 1;
    }
}

.mobile-remove-card-button {
    display: none;
}

@media (max-width: 991.98px) {
    #deck .deck-card-small {
        width: min(29vw, 115px);
        margin: 5px;
    }

    #deck .deck-card-large {
        width: min(82vw, 360px);
        margin: 12px auto;
    }

    #deck .deck-card-image {
        width: 100%;
        height: auto;
    }

    #deck .deck-card-large .mobile-remove-card-button {
        padding: 12px;
        font-size: 17px;
    }

    #deck .cards > div {
        width: min(44%, 190px);
    }

    #deck .cards > div > button[title^="Remove"] {
        display: none !important;
    }
}

/* =========================================================
   Mobile Deck Drawer Handle
========================================================= */

.mobile-drawer-handle {
    display: none;
}

@media (max-width: 991.98px) {
    .mobile-drawer-handle {
        position: sticky;
        top: 0;
        z-index: 30;

        display: flex;
        align-items: flex-start;
        justify-content: center;

        width: 100%;
        height: 54px;
        margin: 0;
        padding: 13px 0 0;

        border: 0;
        border-radius: 18px 18px 0 0;
        background:
            linear-gradient(
                to bottom,
                rgba(0, 0, 0, 1),
                rgba(0, 0, 0, 0.92),
                rgba(0, 0, 0, 0.72)
            );

        cursor: pointer;
        touch-action: manipulation;
    }

    .mobile-drawer-handle span {
        display: block;
        width: 70px;
        height: 7px;
        border-radius: 999px;
        background: #8a8a8a;
        transition:
            background 0.15s ease,
            transform 0.15s ease;
    }

    .mobile-drawer-handle:active span {
        background: #bbb;
        transform: scaleX(0.92);
    }
}

@media (max-width: 991.98px) {
    html.mobile-deck-active,
    body.mobile-deck-active {
        overflow: hidden !important;
        overscroll-behavior: none;
    }

    #deck.overlay.mobile-deck-open {
        overflow-y: auto;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
    }
}

.preview-card-actions {
    position: fixed;
    top: 10px;
    left: 50%;
    z-index: 5003;
    display: flex;
    gap: 12px;
    transform: translateX(-50%);
}

.preview-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    padding: 0;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    background: rgba(20, 20, 20, 0.92);
    font-size: 38px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
}

.preview-add-button {
    border-color: #5dbb72;
    background: rgba(30, 115, 55, 0.95);
}

.preview-remove-button {
    border-color: #dc6767;
    background: rgba(150, 40, 40, 0.95);
}

.preview-action-button[hidden] {
    display: none;
}

@media (max-width: 991.98px) {
    .preview-card-actions {
        top: 8px;
    }

    .preview-action-button {
        width: 56px;
        height: 56px;
        font-size: 42px;
    }
}

.preview-card-actions[hidden],
.preview-action-button[hidden] {
    display: none !important;
}

#zoom:not(.card-preview-open)
    .preview-card-actions {
    display: none !important;
}

/* =========================================================
   Desktop Deck Drawer
========================================================= */

@media (min-width: 992px) {
    #deck.overlay {
        position: fixed;

        top: 0;
        right: auto;
        bottom: auto;
        left: 0 !important;

        width: 0;
        height: 100vh;
        margin: 0 !important;

        overflow-x: hidden;
        overflow-y: auto;

        transform: none !important;
        visibility: visible;
        pointer-events: auto;

        border-right: 1px solid #444;
        background: rgba(0, 0, 0, 0.97);

        z-index: 2100;

        transition: width 0.5s ease;
    }
}

#deck .deck-sidebar-title {
    margin-top: 22px;
}

/* Hide all card-preview controls while the preview is closed */
#zoom:not(.card-preview-open) .preview-close-button,
#zoom:not(.card-preview-open) .preview-card-actions {
    display: none !important;
}

/* Show the close button only while the preview is open */
#zoom.card-preview-open .preview-close-button {
    display: block;
}

/* ==========================================
   Mobile Header
========================================== */

@media (max-width: 991.98px) {

    .navbar {
        min-height: 72px;
        padding: 10px 14px;
    }

    .navbar-brand {
        font-size: 1.45rem;
        font-weight: 700;
    }

    .navbar-nav .nav-link {
        font-size: 1.05rem;
        padding: 10px 12px;
    }

    .navbar-toggler {
        padding: 10px 12px;
        font-size: 1.35rem;
    }

    .navbar .btn {
        min-height: 44px;
        padding: 8px 16px;
        font-size: 1rem;
    }

    .navbar img.rounded-circle {
        width: 38px;
        height: 38px;
    }
}

/* =========================================================
   Deck Card Sizes
========================================================= */

.deck-card-container {
    align-items: stretch;
    margin: 5px;
}

.deck-card-small {
    width: 100px;
}

.deck-card-large {
    width: 300px;
    margin: 10px;
}

.deck-card-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
    cursor: pointer;
}

/* ==========================================
   Card Preview Close Button
========================================== */

#zoom .preview-close-button {
    position: fixed;
    top: 12px;
    right: 20px;
    left: auto;

    z-index: 5003;

    color: white;
    font-size: 54px;
    line-height: 1;
    text-decoration: none;
}

/* Slightly tighter on phones */
@media (max-width: 991.98px) {
    #zoom .preview-close-button {
        top: 6px;
        right: 14px;
        font-size: 52px;
    }
}

/* =========================================================
   FINAL Deck Card Sizing Overrides
   Keep this block at the absolute bottom of the stylesheet.
========================================================= */

#deck .deck-card-container {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    width: 100px !important;
    margin: 5px;
    vertical-align: top;
}

#deck .deck-card-container.deck-card-small {
    width: 100px !important;
    margin: 5px;
}

#deck .deck-card-container.deck-card-large {
    width: 300px !important;
    margin: 10px;
}

#deck .deck-card-image {
    display: block;
    width: 100% !important;
    max-width: none !important;
    height: auto;
    border-radius: 4px;
    cursor: pointer;
}

/* The small circular X remains the desktop removal control. */
#deck .mobile-remove-card-button {
    display: none;
}

@media (max-width: 991.98px) {
    #deck .deck-card-container.deck-card-small {
        width: min(29vw, 115px) !important;
        margin: 5px;
    }

    #deck .deck-card-container.deck-card-large {
        display: flex;
        width: min(82vw, 360px) !important;
        margin: 14px auto;
    }

    #deck .deck-card-container .deck-card-image {
        width: 100% !important;
        max-width: none !important;
        height: auto;
    }

    #deck .mobile-remove-card-button {
        display: block;
        width: 100%;
        margin-top: 7px;
        font-weight: bold;
    }

    #deck .deck-card-container.deck-card-large
        .mobile-remove-card-button {
        padding: 12px;
        font-size: 17px;
    }

    /* Hide the small circular X on mobile. */
    #deck .deck-card-container
        > button[title^="Remove"] {
        display: none !important;
    }
}

/* Six class buttons in one row on desktop */
.search-class-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

/* Responsive fallbacks */
@media (max-width: 900px) {
    .search-class-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .search-class-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


.mobile-navbar-actions {
    display: none;
}

@media (max-width: 991.98px) {
    .mobile-navbar-actions {
        display: flex;
        align-items: center;
        margin-left: auto;
        gap: 8px;
    }

    .mobile-my-decks-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        padding: 8px 12px;
        font-weight: 700;
        white-space: nowrap;
    }

    .navbar-toggler {
        margin: 0;
    }
}

.builder-status-invalid {
    padding: 10px;
    color: #ffd0d0;
    border: 1px solid #ad4545;
    border-radius: 8px;
    background: rgba(170, 40, 40, 0.25);
    font-weight: bold;
    text-align: center;
}

@media (max-width: 991.98px) {
    html.mobile-deck-active,
    body.mobile-deck-active {
        overscroll-behavior: none;
    }

    #deck.overlay {
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
    }

    #deck #cards {
        overscroll-behavior-y: contain;
    }
}

@media (max-width: 991.98px) {
    .mobile-deck-bar {
        touch-action: pan-x;
        overscroll-behavior: contain;
    }
}

/* =========================================================
   Compact Deck View
   Used by templates/deckView.html
========================================================= */

.deck-showcase-page {
    width: min(1700px, 98%);
    margin: 16px auto 40px;
    color: #fff;
}

/* ---------------------------------------------------------
   Header
--------------------------------------------------------- */

.deck-showcase-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    gap: 18px;
    border: 1px solid #474747;
    border-radius: 12px;
    background: linear-gradient(135deg, #111, #252525);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.deck-showcase-heading {
    min-width: 0;
}

.deck-showcase-eyebrow {
    display: block;
    color: #aaa;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
}

.deck-showcase-header h1 {
    margin: 3px 0 8px;
    overflow-wrap: anywhere;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.05;
}

.deck-showcase-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.deck-showcase-meta > span {
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 13px;
    font-weight: 700;
}

.deck-showcase-status-valid {
    color: #baffca;
    border: 1px solid #318b4a;
}

.deck-showcase-status-incomplete {
    color: #ffe3a1;
    border: 1px solid #b7872c;
}

.deck-showcase-status-invalid {
    color: #ffc0c0;
    border: 1px solid #aa4545;
}

.deck-showcase-header-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.deck-showcase-header-actions .btn {
    min-width: 100px;
}

/* ---------------------------------------------------------
   Validation messages
--------------------------------------------------------- */

.deck-showcase-notices {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 12px 0;
    padding: 9px 12px;
    gap: 8px;
    color: #ffe4ae;
    border: 1px solid #87672e;
    border-radius: 9px;
    background: rgba(120, 85, 20, 0.22);
    font-size: 13px;
    text-align: center;
}

/* ---------------------------------------------------------
   Credit curve
--------------------------------------------------------- */

.deck-showcase-curve {
    margin: 12px 0;
    padding: 10px 16px 12px;
    border: 1px solid #414141;
    border-radius: 10px;
    background: #181818;
}

.deck-showcase-section-heading {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 1.3px;
    text-align: center;
    text-transform: uppercase;
}

.deck-showcase-curve-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    align-items: end;
    max-width: 650px;
    height: 90px;
    margin: 0 auto;
    gap: 10px;
}

.deck-showcase-curve-column {
    display: grid;
    grid-template-rows: 18px 1fr 18px;
    height: 100%;
    font-size: 12px;
    text-align: center;
}

.deck-showcase-curve-count,
.deck-showcase-curve-value {
    font-weight: 800;
}

.deck-showcase-curve-track {
    position: relative;
    overflow: hidden;
    border-radius: 6px 6px 2px 2px;
    background: #333;
}

.deck-showcase-curve-fill {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: 2px;
    background: linear-gradient(to top, #a9751c, #f0d17c);
}

/* ---------------------------------------------------------
   Main layout
--------------------------------------------------------- */

.deck-showcase-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 225px;
    align-items: start;
    gap: 14px;
}

.deck-showcase-card-list {
    display: grid;
    min-width: 0;
    gap: 9px;
}

/* ---------------------------------------------------------
   Credit-value sections
--------------------------------------------------------- */

.compact-value-section {
    position: relative;
    overflow: visible;
    border: 1px solid #414141;
    border-radius: 9px;
    background: #151515;
}

.compact-value-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 38px;
    padding: 5px 10px;
    border-radius: 8px 8px 0 0;
    background: linear-gradient(90deg, #2d2d2d, #191919);
}

.compact-value-section-5 .compact-value-header,
.compact-value-section-4 .compact-value-header {
    background: linear-gradient(90deg, #684b15, #241b0c);
}

.compact-value-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.7px;
    text-transform: uppercase;
}

.compact-value-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    border: 1px solid #e1c36b;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 900;
}

.compact-value-count {
    color: #bbb;
    font-size: 11px;
    font-weight: 700;
}

/* ---------------------------------------------------------
   Five-column compact card rows
--------------------------------------------------------- */

.compact-deck-list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.compact-deck-row {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    align-items: center;
    min-width: 0;
    min-height: 66px;
    padding: 5px 7px;
    gap: 8px;
    border-right: 1px solid #303030;
    border-bottom: 1px solid #303030;
    background: #171717;
}

.compact-deck-row:nth-child(odd) {
    background: #1b1b1b;
}

.compact-deck-row:nth-child(5n) {
    border-right: 0;
}

.compact-deck-row:hover {
    z-index: 100;
    background: #242424;
}

/*
 * True top-half crop. At 60px wide, a 5:7 card is about
 * 84px tall; the 42px wrapper displays its upper half.
 */
.compact-deck-thumbnail-wrap {
    position: relative;
    width: 60px;
    height: 42px;
    overflow: hidden;
    border: 1px solid #3f3f3f;
    border-radius: 5px;
    background: #080808;
    cursor: pointer;
}

.compact-deck-thumbnail {
    display: block;
    width: 60px;
    height: auto;
    max-width: none;
    border-radius: 4px;
}

.compact-deck-row-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    gap: 5px;
}

.compact-deck-card-heading {
    display: flex;
    align-items: baseline;
    min-width: 0;
    gap: 5px;
}

.compact-deck-quantity {
    flex: 0 0 auto;
    color: #e6cc7d;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

.compact-deck-name {
    min-width: 0;
    overflow: hidden;
    color: white;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-deck-classes {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 3px;
}

.compact-deck-class {
    max-width: 100%;
    padding: 2px 5px;
    overflow: hidden;
    color: #c8c8c8;
    border: 1px solid #494949;
    border-radius: 999px;
    background: #282828;
    font-size: 8px;
    font-weight: 700;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------------------------------------------------------
   Full-card hover preview
--------------------------------------------------------- */

/*
 * In deckView.html, this full preview image must be a direct
 * child of .compact-deck-row and outside the cropped wrapper.
 */
.compact-deck-hover-preview {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 7000;
    display: none;
    width: min(280px, 30vw);
    max-height: 86vh;
    border: 2px solid #777;
    border-radius: 10px;
    background: #111;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.78);
    object-fit: contain;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
    .compact-deck-row:hover > .compact-deck-hover-preview {
        display: block;
    }
}

/* ---------------------------------------------------------
   Statistics sidebar
--------------------------------------------------------- */

.deck-showcase-sidebar {
    position: sticky;
    top: 12px;
    display: grid;
    gap: 10px;
}

.deck-showcase-stat-panel {
    padding: 12px;
    border: 1px solid #424242;
    border-radius: 9px;
    background: #191919;
}

.deck-showcase-stat-panel h2 {
    margin: 0 0 9px;
    font-size: 15px;
    letter-spacing: 0.5px;
    text-align: center;
    text-transform: uppercase;
}

.deck-showcase-big-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.deck-showcase-big-stats > div {
    padding: 10px 6px;
    border-radius: 8px;
    background: #282828;
    text-align: center;
}

.deck-showcase-big-stats strong {
    display: block;
    font-size: 23px;
    line-height: 1;
}

.deck-showcase-big-stats span {
    display: block;
    margin-top: 4px;
    color: #aaa;
    font-size: 10px;
    text-transform: uppercase;
}

.deck-showcase-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    gap: 10px;
    border-bottom: 1px solid #303030;
    font-size: 12px;
}

.deck-showcase-stat-row:last-child {
    border-bottom: 0;
}

.deck-showcase-stat-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------------------------------------------------------
   Responsive deck view
--------------------------------------------------------- */

@media (max-width: 1450px) {
    .compact-deck-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .compact-deck-row {
        border-right: 1px solid #303030;
    }

    .compact-deck-row:nth-child(4n) {
        border-right: 0;
    }
}

@media (max-width: 1150px) {
    .compact-deck-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .compact-deck-row {
        border-right: 1px solid #303030;
    }

    .compact-deck-row:nth-child(3n) {
        border-right: 0;
    }
}

@media (max-width: 1000px) {
    .deck-showcase-layout {
        grid-template-columns: 1fr;
    }

    .deck-showcase-sidebar {
        position: static;
        grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    }
}

@media (max-width: 850px) {
    .compact-deck-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .compact-deck-row {
        border-right: 1px solid #303030;
    }

    .compact-deck-row:nth-child(2n) {
        border-right: 0;
    }
}

@media (max-width: 700px) {
    .deck-showcase-page {
        width: 96%;
        margin-top: 10px;
    }

    .deck-showcase-header {
        flex-direction: column;
        align-items: stretch;
        padding: 14px;
        text-align: center;
    }

    .deck-showcase-meta,
    .deck-showcase-header-actions {
        justify-content: center;
    }

    .deck-showcase-header-actions .btn {
        flex: 1;
        min-width: 0;
    }

    .deck-showcase-curve-grid {
        gap: 6px;
    }
}

@media (max-width: 600px) {
    .compact-deck-list {
        grid-template-columns: 1fr;
    }

    .compact-deck-row {
        grid-template-columns: 84px minmax(0, 1fr);
        min-height: 78px;
        border-right: 0;
    }

    .compact-deck-thumbnail-wrap {
        width: 84px;
        height: 59px;
    }

    .compact-deck-thumbnail {
        width: 84px;
    }

    .compact-deck-name {
        font-size: 16px;
    }

    .compact-deck-class {
        font-size: 10px;
    }

    .compact-deck-hover-preview {
        display: none !important;
    }
}

/* ---------------------------------------------------------
   Print / screenshot-friendly layout
--------------------------------------------------------- */

@media print {
    #mainNavbar,
    .deck-showcase-header-actions {
        display: none !important;
    }

    .deck-showcase-page {
        width: 100%;
        margin: 0;
        color: #000;
    }

    .deck-showcase-layout {
        grid-template-columns: minmax(0, 1fr) 210px;
    }

    .deck-showcase-sidebar {
        position: static;
    }

    .deck-showcase-header,
    .deck-showcase-curve,
    .compact-value-section,
    .deck-showcase-stat-panel {
        color: #000;
        border-color: #999;
        background: #fff;
        box-shadow: none;
    }

    .compact-deck-hover-preview {
        display: none !important;
    }
}

/* Fix card-name width inside compact Deck View rows */
.compact-deck-row-content {
    min-width: 0;
    width: 100%;
}

.compact-deck-card-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    width: 100%;
    min-width: 0;
    gap: 5px;
}

.compact-deck-name {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    color: white;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deck-import-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
    gap: 8px;
}

.deck-import-form .btn {
    margin: 0;
}

@media (max-width: 650px) {
    .deck-import-form {
        width: 100%;
    }

    .deck-import-form .btn {
        width: 100%;
    }
}

#deckImportLabel.disabled {
    pointer-events: none;
    opacity: 0.65;
}

.deck-showcase-curve-value {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;

    font-size: 18px;
    font-weight: 700;
    color: white;
}

.credit-icon {
    width: 14px;
    height: 14px;
    display: inline-block;
}

.my-decks-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.my-decks-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.deck-showcase-curve-grid {
    display: grid;
    gap: 16px;
}

/* Mobile press-and-hold card preview */
@media (hover: none) and (pointer: coarse) {

    .compact-deck-row.is-previewing
    .compact-deck-hover-preview {
        display: block;
        opacity: 1;
        visibility: visible;
        pointer-events: none;

        position: fixed;
        z-index: 9999;

        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);

        width: min(78vw, 360px);
        height: auto;
        max-height: 82vh;
        object-fit: contain;
    }

    .compact-deck-row.is-previewing::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 9998;
        background: rgba(0, 0, 0, 0.7);
    }

    .compact-deck-row.is-previewing
    .compact-deck-hover-preview {
        z-index: 9999;
    }
}

.unified-card-viewer-value {
    display: none;
}

.compact-deck-hover-preview {
    position: absolute;
    top: 50%;
    left: calc(100% + 10px);
    z-index: 7000;

    display: none;
    width: 650px;
    max-width: 70vw;
    max-height: 80vh;
    height: auto;
    object-fit: contain;

    border: 2px solid #777;
    border-radius: 10px;
    background: #111;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.75);

    transform: translateY(-50%);
    pointer-events: none;
}

.compact-deck-hover-preview {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 7000;

    display: none;
    width: min(650px, 70vw);
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    height: auto;

    border: 2px solid #777;
    border-radius: 10px;
    background: #111;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.78);

    object-fit: contain;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* Hide the large hover image until its row is hovered. */
.compact-deck-row > img.compact-deck-hover-preview {
    display: none !important;
    position: fixed !important;

    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;

    width: min(650px, 70vw) !important;
    max-width: calc(100vw - 32px) !important;
    max-height: calc(100vh - 32px) !important;
    height: auto !important;

    z-index: 10000 !important;
    object-fit: contain;
    pointer-events: none;

    border: 2px solid #777;
    border-radius: 10px;
    background: #111;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.8);
}

/* Only display it while hovering the card row. */
@media (hover: hover) and (pointer: fine) {
    .compact-deck-row:hover
    > img.compact-deck-hover-preview {
        display: block !important;
    }
}

.compact-deck-row > .compact-deck-hover-preview {
    width: min(420px, 42vw) !important;
    max-height: calc(100vh - 48px) !important;
}

.stat-row {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 58px;
    align-items: center;
    margin: 7px 0;
    gap: 10px;
}

.stat-count-left {
    font-weight: bold;
    text-align: right;
}

.stat-credit-axis {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    font-weight: bold;
    white-space: nowrap;
}

.stat-credit-icon {
    display: block;
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.stat-bar-track {
    width: 100%;
    height: 12px;
    overflow: hidden;
    border-radius: 10px;
    background: #404040;
}

.stat-bar-fill {
    min-width: 0;
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(
        90deg,
        #2375cf,
        #63b5ff
    );
}

.stat-row[hidden] {
    display: none;
}

.stat-row {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 32px;
    align-items: center;
    margin: 7px 0;
    gap: 10px;
}

.stat-credit-axis {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    font-weight: bold;
    white-space: nowrap;
}

.stat-credit-icon {
    display: block;
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.stat-count {
    font-weight: bold;
    text-align: left;
}

.stat-row {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) 32px;
    align-items: center;
    gap: 10px;
    margin: 7px 0;
}

.stat-credit-axis {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    font-weight: bold;
    white-space: nowrap;
}

.stat-count {
    font-weight: bold;
    text-align: left;
}

.card-browser-item {
    flex-direction: column;
    align-items: center;
}

.card-add-button {
    margin-top: 6px;
}

/* Desktop card library layout */
@media (min-width: 992px) {

    #pictures .card-browser-item {
        display: inline-flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;

        width: 280px !important;
        height: auto !important;
        min-height: 0 !important;

        margin: 8px !important;
        vertical-align: top !important;
    }

    #pictures .card-browser-item > .cardImages {
        display: block !important;
        width: 280px !important;
        height: auto !important;
        margin: 0 !important;
    }

    #pictures .card-browser-item > .card-add-button {
        position: static !important;
        inset: auto !important;
        transform: none !important;

        display: inline-flex !important;
        align-self: center !important;

        margin: 6px 0 0 !important;
    }
}

/* Card library: prevent cards from overflowing their grid cells */
#pictures {
    display: grid !important;
    grid-template-columns: repeat(
        auto-fit,
        minmax(min(280px, 100%), 280px)
    );
    justify-content: center;
    align-items: start;
    gap: 18px 10px;
}

#pictures .card-browser-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;

    width: 280px !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;

    margin: 0 !important;
}

#pictures .card-browser-item > .cardImages {
    display: block !important;
    width: 280px !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 !important;
}

#pictures .card-browser-item > .card-add-button {
    position: static !important;
    transform: none !important;
    align-self: center !important;
    margin: 8px 0 0 !important;
}

@media (max-width: 767.98px) {

    #pictures {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 14px 8px !important;
        padding: 0 8px;
    }

    #pictures .card-browser-item {
        width: 100% !important;
        max-width: 100% !important;
    }

    #pictures .card-browser-item > .cardImages {
        width: 100% !important;
        max-width: 100% !important;
    }

    #pictures .card-browser-item > .card-add-button {
        width: auto !important;
        max-width: 100%;
        padding: 7px 10px;
        font-size: 14px;
        white-space: nowrap;
    }
}

#pictures .card-browser-item[hidden] {
    display: none !important;
}

html,
body {
    margin: 0;
    min-height: 100%;
    width: 100%;
    overflow-x: hidden;

    background:
        radial-gradient(
            circle at 15% 15%,
            rgba(42, 88, 140, 0.20),
            transparent 35%
        ),
        radial-gradient(
            circle at 85% 30%,
            rgba(80, 45, 120, 0.16),
            transparent 40%
        ),
        linear-gradient(
            180deg,
            #11151d 0%,
            #171c26 45%,
            #0d1118 100%
        );
}

body {
    min-height: 100vh;
    min-height: 100dvh;

    color: #f2f2f2;
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

img,
video,
canvas {
    max-width: 100%;
}

html,
body {
    max-width: 100%;
    overflow-x: clip;
}

.main-content,
.page-container {
    background: rgba(18, 23, 32, 0.82);

    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;

    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.30);

    backdrop-filter: blur(8px);
}

body {
    position: relative;
}

.container,
.container-fluid,
.row {
    max-width: 100%;
}

html {
    min-height: 100%;
    background: #0b1018;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    margin: 0;

    background:
        linear-gradient(
            180deg,
            #111722 0%,
            #0b1018 100%
        );

    overflow-x: hidden;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

.background {
    width: 100%;
    min-height: 100vh;
    padding: 18px;

    border: none;

    background:
        radial-gradient(
            circle at 15% 10%,
            rgba(45, 95, 155, 0.20),
            transparent 34%
        ),
        radial-gradient(
            circle at 85% 22%,
            rgba(95, 55, 145, 0.16),
            transparent 38%
        ),
        radial-gradient(
            circle at 50% 100%,
            rgba(15, 90, 105, 0.12),
            transparent 45%
        ),
        linear-gradient(
            180deg,
            #111722 0%,
            #161d29 45%,
            #0b1018 100%
        );

    transition:
        width 0.7s ease,
        margin-left 0.7s ease;
}

.page-panel {
    background: rgba(24, 31, 43, 0.92);

    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;

    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.28);

    backdrop-filter: blur(8px);
}

fieldset {
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 12px;

    background: rgba(20, 26, 36, 0.78);
}

legend {
    width: auto;
    padding: 0 8px;

    color: #dce5f2;
    background: transparent;

    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cardImages {
    transition:
        transform 0.18s ease,
        filter 0.18s ease,
        box-shadow 0.18s ease;
}

.cardImages:hover {
    cursor: pointer;

    transform: translateY(-3px);

    filter: brightness(1.05);

    box-shadow:
        0 10px 26px rgba(0, 0, 0, 0.35);
}

@media (max-width: 600px) {
    .background {
        padding: 10px;
    }

    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    img {
        max-width: 100%;
        height: auto;
    }
}

.background {
    width: 100%;
    min-height: 100vh;
    padding: 18px;
    border: none;

    background:
        radial-gradient(
            circle at 15% 10%,
            rgba(70, 115, 165, 0.18),
            transparent 34%
        ),
        radial-gradient(
            circle at 85% 22%,
            rgba(90, 80, 145, 0.12),
            transparent 38%
        ),
        linear-gradient(
            180deg,
            #1b2738 0%,
            #202c3d 45%,
            #172231 100%
        );

    transition:
        width 0.7s ease,
        margin-left 0.7s ease;
}

html,
body {
    min-height: 100%;
    margin: 0;
    overflow-x: hidden;

    background: #172231;
}

.search-panel,
.deck-builder-panel,
.page-panel {
    background: rgba(28, 33, 40, 0.94);

    border: 1px solid rgba(190, 200, 215, 0.22);

    border-radius: 14px;

    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.20);
}

#HeadBanner {
    display: block;
    width: 600px;
    max-width: 100%;
    height: auto;
    margin: 25px auto 15px;

    border-radius: 12px;

    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.18);
}

#HeadBanner {
    display: block;
    width: 600px;
    max-width: 100%;
    height: auto;
    margin: 25px auto 0;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.advanced-search-wrapper {
    position: relative;
    z-index: 2;
    width: min(1040px, 92%);
    margin: -70px auto 35px;
}

.deck-builder-layout {
    display: flex;
    width: 100%;
    min-width: 0;
}

#deckBuilderSidebar {
    width: 320px;
    min-width: 240px;
    max-width: 520px;
    flex-shrink: 0;
}

#deckBuilderResizeHandle {
    width: 6px;
    flex-shrink: 0;

    cursor: col-resize;

    background: rgba(255, 255, 255, 0.08);

    transition: background 0.15s ease;
}

#deckBuilderResizeHandle:hover,
#deckBuilderResizeHandle.is-resizing {
    background: rgba(120, 170, 230, 0.45);
}

.deck-builder-main {
    flex: 1;
    min-width: 0;
}

@media (max-width: 991.98px) {
    #deckBuilderResizeHandle {
        display: none;
    }

    #deckBuilderSidebar {
        width: 100% !important;
        max-width: none;
    }
}

@media (min-width: 992px) {

    .deck-resize-handle {
        position: fixed;

        top: 0;
        left: var(--deck-sidebar-width);

        z-index: 9999;

        display: none;

        width: 16px;
        height: 100vh;

        transform: translateX(-50%);

        cursor: col-resize;
        touch-action: none;

        background: transparent;
    }

    .deck-resize-handle.is-open {
        display: block;
    }


    /* Visible vertical resize rail */
    .deck-resize-handle::before {
        content: "";

        position: absolute;

        top: 0;
        bottom: 0;
        left: 50%;

        width: 4px;

        transform: translateX(-50%);

        background: rgba(160, 180, 205, 0.65);

        box-shadow:
            -1px 0 0 rgba(255, 255, 255, 0.08),
            2px 0 6px rgba(0, 0, 0, 0.35);

        transition:
            width 0.15s ease,
            background 0.15s ease;
    }


    /* Grip in the middle */
    .deck-resize-handle::after {
        content: "⋮";

        position: absolute;

        top: 50%;
        left: 50%;

        display: flex;
        align-items: center;
        justify-content: center;

        width: 18px;
        height: 54px;

        transform: translate(-50%, -50%);

        color: #d7e2ef;

        border: 1px solid rgba(255, 255, 255, 0.18);
        border-radius: 8px;

        background: #27364a;

        font-size: 24px;
        font-weight: bold;
        line-height: 1;

        box-shadow:
            0 4px 12px rgba(0, 0, 0, 0.35);
    }


    .deck-resize-handle:hover::before,
    .deck-resize-handle.is-resizing::before {
        width: 6px;

        background: #6fa7df;
    }


    .deck-resize-handle:hover::after,
    .deck-resize-handle.is-resizing::after {
        background: #365477;
        border-color: #7db6ee;
    }


    body.deck-sidebar-resizing,
    body.deck-sidebar-resizing * {
        cursor: col-resize !important;
        user-select: none !important;
    }


    body.deck-sidebar-resizing #deck,
    body.deck-sidebar-resizing #background,
    body.deck-sidebar-resizing #mainNavbar {
        transition: none !important;
    }
}