/* =========================================================
   AlteredCore – Custom styles (Bootstrap 5 override)
   ========================================================= */

:root {
    --sand-50:      #FDFBF6;
    --sand-100:     #FAF5E8;
    --sand-200:     #EDE3CC;
    --sand-300:     #DDD0B3;
    --primary-300:  #D4AF6B;
    --primary-400:  #C9A84C;
    --primary-500:  #B8952F;
    --neutral-800:  #2C2416;
    --neutral-700:  #3D3226;
    --neutral-600:  #534B40;
    --neutral-500:  #6B6257;
    --neutral-400:  #8A7D6A;
    --neutral-300:  #C0A697;
    --neutral-200:  #D6CFC4;
    --neutral-100:  #EDE8E2;
}

/* ---- Base ---- */
body {
    background-color: var(--sand-100);
    color: var(--neutral-800);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.site-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}
body.page-fullwidth main {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
}
body.page-fullwidth main .container,
body.page-fullwidth main .container-sm,
body.page-fullwidth main .container-md,
body.page-fullwidth main .container-lg,
body.page-fullwidth main .container-xl,
body.page-fullwidth main .container-xxl {
    max-width: 100%;
}

a { color: var(--primary-500); }
a:hover { color: var(--primary-400); }

/* ---- Header / Navbar ---- */
.site-header {
    background: var(--sand-100);
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.altered-navbar {
    background-color: var(--sand-100);
    border: 4px solid var(--sand-200);
    border-radius: 1.5rem;
    padding: 0.25rem 0.75rem;
}

.navbar-brand { display: flex; align-items: center; gap: 0.5rem; }
.navbar-brand svg { flex-shrink: 0; width: 24px; height: auto; }
.navbar-brand svg path { fill: var(--neutral-600); }
.navbar-logo-custom { height: 36px; width: auto; display: block; object-fit: contain; }
.navbar-site-name {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--neutral-700);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.navbar-toggler {
    border: none;
    background: transparent;
    color: var(--neutral-600);
    font-size: 1.1rem;
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
}
.navbar-toggler:hover { background: var(--sand-200); }
.navbar-toggler:focus { box-shadow: none; }

.altered-navbar .nav-link {
    color: var(--neutral-800);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    padding: 0.45rem 0.75rem;
    border-radius: 0.5rem;
    transition: background-color 0.15s ease-out, color 0.15s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    white-space: nowrap;
}
.altered-navbar .nav-link i { font-size: 0.9rem; }

/* Mobile collapsed menu */
@media (max-width: 767.98px) {
    .site-header {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .altered-navbar .navbar-collapse {
        border-top: 2px solid var(--sand-300);
        margin-top: 0.4rem;
        padding-top: 0.5rem;
        padding-bottom: 0.25rem;
    }
    .altered-navbar .navbar-nav { flex-direction: column; gap: 0 !important; width: 100%; }
    .altered-navbar .nav-link {
        flex-direction: row;
        gap: 0.6rem;
        padding: 0.55rem 0.5rem;
        border-radius: 0.5rem;
        width: 100%;
    }
    .altered-navbar .navbar-right {
        border-top: 1px solid var(--sand-300);
        margin-top: 0.4rem;
        padding-top: 0.5rem;
        width: 100%;
    }
    .altered-navbar .btn-user-badge,
    .altered-navbar .btn-login { width: 100%; justify-content: flex-start; }
}

/* Mobile compact header (MOBILE_HEADER_MODE = 1) — icon bar, no title, no burger */
@media (max-width: 767.98px) {
    .mobile-nav-compact .navbar-toggler { display: none !important; }
    .mobile-nav-compact .navbar-brand .navbar-site-name { display: none !important; }
    /* Keep logo + mainNav on a single line */
    .mobile-nav-compact .altered-navbar > .container-fluid { flex-wrap: nowrap; align-items: center; }
    .mobile-nav-compact .navbar-logo-custom { height: 28px; }
    .mobile-nav-compact .navbar-brand svg { width: 20px; }
    /* Theme toggle + lang dropdown move to footer on mobile */
    .mobile-nav-compact #header-theme-toggle,
    .mobile-nav-compact .navbar-right > .dropdown-lang { display: none !important; }

    .mobile-nav-compact #mainNav {
        display: flex !important;
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        border-top: none !important;
        margin-top: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
    .mobile-nav-compact .altered-navbar .navbar-nav {
        flex-direction: row !important;
        flex: 1 !important;
        width: auto !important;
        flex-wrap: nowrap;
        justify-content: space-evenly;
    }
    .mobile-nav-compact .altered-navbar .nav-link {
        flex-direction: column !important;
        width: auto !important;
        padding: 0.4rem 0.45rem !important;
        gap: 0 !important;
    }
    /* Hide text labels in nav items and dropdown arrow */
    .mobile-nav-compact .altered-navbar .navbar-nav .nav-link span,
    .mobile-nav-compact .altered-navbar .navbar-nav .dropdown-toggle span { display: none !important; }
    .mobile-nav-compact .altered-navbar .navbar-nav .dropdown-toggle::after { display: none !important; }
    .mobile-nav-compact .altered-navbar .navbar-right {
        border-top: none !important;
        margin-top: 0 !important;
        padding-top: 0 !important;
        width: auto !important;
        flex-shrink: 0;
    }
    /* Login/user buttons: icon only, no text, no arrow */
    .mobile-nav-compact .altered-navbar .btn-user-badge span,
    .mobile-nav-compact .altered-navbar .btn-login span { display: none !important; }
    .mobile-nav-compact .altered-navbar .btn-user-badge::after { display: none !important; }
    .mobile-nav-compact .altered-navbar .btn-user-badge i,
    .mobile-nav-compact .altered-navbar .btn-login i { margin-right: 0 !important; }
    .mobile-nav-compact .altered-navbar .btn-user-badge,
    .mobile-nav-compact .altered-navbar .btn-login {
        width: auto !important;
        justify-content: center !important;
    }
}

@media (min-width: 768px) {
    .altered-navbar .nav-link { flex-direction: row; gap: 0.4rem; }
    .navbar-site-name { display: inline !important; }
}
.altered-navbar .nav-link:hover,
.altered-navbar .nav-link.active {
    background-color: var(--primary-400);
    color: var(--neutral-800);
    text-decoration: none;
}
/* Icons-only mode: hide label text, keep icon */
.altered-navbar.icons-only .navbar-nav .nav-link span,
.altered-navbar.icons-only .navbar-nav .dropdown-toggle span {
    display: none;
}

.btn-lang {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--neutral-600);
    background: var(--sand-200);
    border: 2px solid var(--sand-300);
    border-radius: 0.5rem;
    padding: 0.3rem 0.65rem;
    transition: background 0.15s;
    cursor: pointer;
    line-height: 1.4;
}
.btn-lang:hover,
.btn-lang:focus,
.btn-lang.show { background: var(--sand-300); color: var(--neutral-800); outline: none; box-shadow: none; }

.btn-login {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--neutral-800);
    background: var(--primary-400);
    border: 2px solid var(--primary-500);
    border-radius: 0.5rem;
    padding: 0.3rem 0.8rem;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}
.btn-login:hover { background: var(--primary-500); color: var(--neutral-800); text-decoration: none; }

/* ---- Login page ---- */
.login-option {
    background: var(--sand-50);
    border: 2px solid var(--sand-200);
    border-radius: 1rem;
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--neutral-800);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.login-option:hover {
    border-color: var(--primary-400);
    box-shadow: 0 4px 16px rgba(201,168,76,0.18);
    color: var(--neutral-800);
}
.login-option-icon {
    width: 48px;
    height: 48px;
    background: var(--sand-200);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--neutral-700);
    flex-shrink: 0;
}
.login-option--register .login-option-icon {
    background: var(--primary-400);
    color: var(--neutral-800);
}
.login-option-body { flex: 1; }
.login-option-title { font-weight: 700; font-size: 1rem; margin-bottom: 0.15rem; }
.login-option-desc  { font-size: 0.83rem; color: var(--neutral-500); }
.login-option-arrow { color: var(--neutral-300); font-size: 0.85rem; }
.login-option:hover .login-option-arrow { color: var(--primary-500); }

.btn-user-badge {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--neutral-800);
    background: var(--primary-400);
    border: 2px solid var(--primary-500);
    border-radius: 0.5rem;
    padding: 0.3rem 0.8rem;
    transition: background 0.15s;
    white-space: nowrap;
}
.btn-user-badge:hover,
.btn-user-badge:focus { background: var(--primary-500); color: var(--neutral-800); box-shadow: none; }
.btn-user-badge::after { margin-left: 0.4rem; }

/* ---- Hero ---- */
.hero-stack {
    display: flex;
    flex-direction: column;
    margin: 1rem;
    border-radius: 1.25rem;
    overflow: hidden;
}
.hero-stack .hero {
    flex: 1;
    margin: 0;
    border-radius: 0;
}
.hero-stack.has-announcement .hero {
    padding-top: 3rem;
    padding-bottom: 3rem;
}
.hero-announcement {
    padding: 0.85rem 0;
    display: flex;
    align-items: center;
    border-radius: 0;
}
/* Map Bootstrap alert color names to CSS vars (fallback to info palette) */
.hero-announcement.alert-primary   { background: #cfe2ff; color: #052c65; }
.hero-announcement.alert-secondary { background: #e2e3e5; color: #2b2d2f; }
.hero-announcement.alert-success   { background: #d1e7dd; color: #0a3622; }
.hero-announcement.alert-danger    { background: #f8d7da; color: #58151c; }
.hero-announcement.alert-warning   { background: #fff3cd; color: #4d3a00; }
.hero-announcement.alert-info      { background: #cff4fc; color: #055160; }
.hero-announcement.alert-light     { background: #fefefe; color: #636464; }
.hero-announcement.alert-dark      { background: #d3d3d4; color: #1a1c1e; }
.hero-announcement-title { font-weight: 700; font-size: .95rem; line-height: 1.3; }
.hero-announcement-text  { font-size: .875rem; line-height: 1.4; margin-top: .15rem; }
.hero {
    background: linear-gradient(135deg, var(--neutral-800) 0%, var(--neutral-600) 50%, var(--neutral-700) 100%);
    color: var(--sand-100);
    padding: 5rem 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-radius: 1.25rem;
    margin: 1rem;
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 60% 50%, rgba(201,168,76,0.18) 0%, transparent 70%);
}
.hero-content { position: relative; z-index: 1; }
.hero-overlay  { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    color: var(--sand-100);
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}
.hero p {
    font-size: 1.15rem;
    color: var(--sand-200);
    max-width: 550px;
    margin: 0 auto 2rem;
}
.btn-hero {
    background: var(--primary-400);
    border: 2px solid var(--primary-500);
    color: var(--neutral-800);
    font-weight: 700;
    font-size: 1rem;
    padding: 0.7rem 2rem;
    border-radius: 0.75rem;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
    display: inline-block;
}
.btn-hero:hover { background: var(--primary-500); color: var(--neutral-800); transform: translateY(-1px); text-decoration: none; }

/* ---- Section headings ---- */
.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--neutral-800);
    margin-top: 0;
    margin-bottom: 1.5rem;
}
.section-title span {
    display: inline-block;
    border-bottom: 3px solid var(--primary-400);
    padding-bottom: 0.1rem;
}

/* ---- News cards ---- */
.news-card {
    background: var(--sand-50);
    border: 2px solid var(--sand-200);
    border-radius: 1rem;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.news-card:hover { box-shadow: 0 8px 24px rgba(44,36,22,0.12); transform: translateY(-3px); }

.news-card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    object-position: center center;
    background: linear-gradient(135deg, var(--sand-200) 0%, var(--sand-300) 100%);
    display: block;
}
.news-card-video {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    overflow: hidden;
}
.news-card-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    pointer-events: none;
}
.news-card-img-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, var(--sand-200) 0%, var(--primary-300) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--neutral-600);
    font-size: 2rem;
}

.news-card-body {
    padding: 1rem 1.25rem 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.news-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    font-size: 0.78rem;
    color: var(--neutral-500);
}
.badge-category {
    background: var(--primary-400);
    color: var(--neutral-800);
    font-weight: 700;
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: 0.4rem;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-category:hover { background: var(--primary-500); color: var(--neutral-800); text-decoration: none; }

.badge-source {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 20px;
    background: var(--neutral-200);
    color: var(--neutral-600);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.news-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--neutral-800);
    margin-bottom: 0.5rem;
    line-height: 1.35;
}
.news-card-title a { color: inherit; text-decoration: none; }
.news-card-title a:hover { color: var(--primary-500); }

.news-card-source {
    font-size: 0.72rem;
    color: var(--neutral-500);
    margin-top: -0.2rem;
    margin-bottom: 0.4rem;
}

.news-card-excerpt {
    font-size: 0.88rem;
    color: var(--neutral-600);
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Deck cards with hero/dark background always use white text.
   Dark-mode rules for headings/paragraphs and explicit colour rules on
   news-card sub-elements must be suppressed inside these containers. */
.deck-card-text-white { color: #fff; }
.deck-card-text-white .news-card-title,
.deck-card-text-white .news-card-excerpt { color: inherit; }
[data-theme="dark"] .deck-card-text-white h1,
[data-theme="dark"] .deck-card-text-white h2,
[data-theme="dark"] .deck-card-text-white h3,
[data-theme="dark"] .deck-card-text-white h4,
[data-theme="dark"] .deck-card-text-white h5,
[data-theme="dark"] .deck-card-text-white h6,
[data-theme="dark"] .deck-card-text-white p { color: inherit; }

.news-card-footer {
    margin-top: 1rem;
}
.btn-read-more {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary-500);
    text-decoration: none;
}
.btn-read-more:hover { color: var(--primary-400); text-decoration: underline; }

/* ---- News detail ---- */
.news-detail-header { margin-bottom: 2rem; }
.news-detail-title {
    font-size: clamp(1.6rem, 4vw, 2.5rem);
    font-weight: 800;
    color: var(--neutral-800);
    line-height: 1.2;
    margin-bottom: 1rem;
}
.news-detail-meta { font-size: 0.88rem; color: var(--neutral-500); }
.news-detail-video {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    overflow: hidden;
    border-radius: .75rem;
    margin-bottom: 2rem;
}
.news-detail-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.news-detail-image {
    width: 100%;
    height: 360px;
    object-fit: cover;
    object-position: center center;
    border-radius: 1rem;
    margin-bottom: 2rem;
    border: 2px solid var(--sand-200);
}
.news-detail-content {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--neutral-700);
}
.news-detail-content h2,
.news-detail-content h3 { color: var(--neutral-800); margin-top: 1.5rem; }
.news-detail-content img { max-width: 100%; border-radius: 0.5rem; }
.footer-col-content img { max-width: 100%; height: auto; }
.news-detail-content a:not([class*="btn"]) { color: var(--primary-500); }

/* ---- Category filter ---- */
.cat-filter { margin-bottom: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cat-filter a {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 2rem;
    border: 2px solid var(--sand-300);
    color: var(--neutral-600);
    background: var(--sand-50);
    text-decoration: none;
    transition: all 0.15s;
}
.cat-filter a:hover,
.cat-filter a.active {
    background: var(--primary-400);
    border-color: var(--primary-400);
    color: var(--neutral-800);
}

/* ---- Placeholder pages ---- */
.coming-soon-box {
    text-align: center;
    padding: 5rem 1rem;
    color: var(--neutral-500);
}
.coming-soon-box i { font-size: 3.5rem; color: var(--sand-300); margin-bottom: 1rem; }
.coming-soon-box h1 { font-size: 2rem; font-weight: 800; color: var(--neutral-800); }
.coming-soon-box p { font-size: 1.05rem; }

/* ---- Footer ---- */
.site-footer {
    background: var(--sand-200);
    color: var(--neutral-700);
    padding: 2.5rem 0 1.5rem;
    margin-top: 4rem;
}
.site-footer a { color: var(--neutral-600); text-decoration: none; }
.site-footer a:hover { color: var(--primary-500); }
.site-footer .footer-col-title {
    font-weight: 700;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--neutral-500);
    margin-bottom: .6rem;
}
.site-footer .footer-brand {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--neutral-800);
    margin-bottom: 0.5rem;
}
.site-footer .fw-bold { color: var(--neutral-700); }
.site-footer .footer-tagline { font-size: 0.85rem; color: var(--neutral-500); }
.site-footer .footer-bottom {
    border-top: 1px solid var(--sand-300);
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    font-size: 0.8rem;
    color: var(--neutral-500);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    text-align: center;
}
.site-footer .footer-bottom a { color: var(--neutral-600); }

.btn-lang-footer {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--neutral-500);
    background: transparent;
    border: 1px solid var(--sand-300);
    border-radius: 0.4rem;
    padding: 0.2rem 0.55rem;
    transition: background 0.15s;
    cursor: pointer;
    line-height: 1.5;
}
.btn-lang-footer:hover,
.btn-lang-footer:focus,
.btn-lang-footer.show { background: var(--sand-300); color: var(--neutral-700); outline: none; box-shadow: none; }
.footer-fan-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none !important;
    color: var(--neutral-500) !important;
    font-size: 0.8rem;
    transition: opacity .2s;
}
.footer-fan-badge:hover { opacity: .75; color: var(--neutral-500) !important; }
.footer-fan-badge img { height: 22px; width: auto; opacity: .7; }

/* ---- Pagination ---- */
.pagination-altered .page-link {
    background: var(--sand-50);
    border-color: var(--sand-200);
    color: var(--neutral-800);
    border-radius: 0.5rem !important;
    margin: 0 2px;
    font-weight: 600;
}
.pagination-altered .page-link:hover {
    background: var(--primary-400);
    border-color: var(--primary-400);
    color: var(--neutral-800);
}
.pagination-altered .active .page-link {
    background: var(--primary-400);
    border-color: var(--primary-500);
    color: var(--neutral-800);
}

/* ---- Admin ---- */
.admin-wrapper { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--neutral-800);
    padding: 1.5rem 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.admin-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
}
.admin-sidebar-overlay.active { display: block; }
.admin-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--neutral-500);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}
.admin-menu-toggle:hover { background: var(--sand-200); color: var(--neutral-700); }
.admin-topbar { display: none !important; }
@media (max-width: 768px) { .admin-topbar { display: flex !important; } }
.admin-topbar-left  { display: flex; align-items: center; gap: 8px; }
.admin-topbar-brand {
    font-weight: 700;
    font-size: .92rem;
    color: var(--primary-400);
    text-decoration: none;
}
.admin-topbar-brand:hover { color: var(--primary-300); }
.admin-topbar-brand-suffix { color: var(--neutral-400); font-weight: 400; }
.admin-sidebar .sidebar-user {
    padding: 0.5rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--neutral-600);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .8rem;
    color: var(--neutral-200);
    flex-wrap: wrap;
}
@media (max-width: 768px) {
    .admin-sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100%;
        z-index: 1000;
        transform: translateX(-240px);
        transition: transform .25s ease;
        overflow-y: auto;
    }
    .admin-sidebar.admin-sidebar-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,.35);
    }
    .admin-menu-toggle { display: flex; align-items: center; color: var(--neutral-200); }
    .admin-menu-toggle:hover { background: var(--neutral-600); color: #fff; }
    .admin-topbar {
        display: flex;
        align-items: center;
        margin: -1rem -1rem 1.5rem;
        padding: 10px 1rem;
        background: var(--neutral-800);
        border-bottom: 1px solid var(--neutral-600);
        gap: 8px;
    }
    .admin-main { padding: 1rem; }
}
.admin-sidebar .sidebar-brand {
    padding: 0 1.25rem 1.25rem;
    border-bottom: 1px solid var(--neutral-600);
    margin-bottom: 1rem;
}
.admin-sidebar .sidebar-brand a {
    color: var(--primary-400);
    font-weight: 800;
    font-size: 1.1rem;
    text-decoration: none;
}
.admin-sidebar .sidebar-brand small { display: block; color: var(--neutral-200); font-size: 0.75rem; }
.admin-sidebar .nav-link {
    color: var(--neutral-200);
    padding: 0.5rem 1.25rem;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.15s;
    border-radius: 0;
}
.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: var(--neutral-600);
    color: var(--primary-400);
}
.admin-sidebar .nav-link i { width: 1.2rem; margin-right: 0.5rem; }
.admin-main { flex: 1; padding: 2rem; background: var(--sand-100); min-width: 0; }
.admin-main .card-altered { overflow-x: auto; }
.admin-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.admin-header-bar h1 { font-size: 1.5rem; font-weight: 800; color: var(--neutral-800); margin: 0; }

.card-altered {
    background: var(--sand-50);
    border: 2px solid var(--sand-200);
    border-radius: 0.75rem;
}
.card-altered .card-header {
    background: var(--sand-200);
    border-bottom: 2px solid var(--sand-300);
    border-radius: 0.6rem 0.6rem 0 0;
    font-weight: 700;
}

/* admin table */
.table-altered th {
    background: var(--sand-200);
    color: var(--neutral-700);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}
.table-altered td { vertical-align: middle; }
.table-altered tr:hover td { background: rgba(201,168,76,0.07); }
.table-altered td:last-child,
.table-altered th:last-child { white-space: nowrap; width: 1%; }

/* admin form labels */
.form-label { font-weight: 600; color: var(--neutral-700); font-size: 0.9rem; }
.form-control:focus, .form-select:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 0.2rem rgba(201,168,76,0.25);
}

/* Buttons */
.btn-primary-altered {
    background: var(--primary-400);
    border: 2px solid var(--primary-500);
    color: var(--neutral-800);
    font-weight: 700;
    border-radius: 0.5rem;
    transition: background 0.15s;
}
.btn-primary-altered:hover { background: var(--primary-500); color: var(--neutral-800); border-color: var(--primary-500); }

/* =========================================================
   Dark theme — blue-grey-violet palette
   Applied via [data-theme="dark"] on <html>.
   Front-end only — admin pages are excluded by design.
   ========================================================= */

[data-theme="dark"] {
    /* Theme palette */
    --sand-50:     #0c0d16;
    --sand-100:    #12141f;
    --sand-200:    #1a1c2b;
    --sand-300:    #262940;
    --neutral-800: #e4e6f2;
    --neutral-700: #b8bdd4;
    --neutral-600: #8890b0;
    --neutral-500: #7a7ea0;
    --neutral-400: #626888;
    --neutral-300: #444864;
    --neutral-200: #262940;
    --neutral-100: #1a1c2b;

    /* Bootstrap 5 CSS vars — cascade automatically to all BS5 components
       (.text-muted, headings, form-label, borders, links, etc.) */
    --bs-body-color:          #e4e6f2;
    --bs-body-color-rgb:      228, 230, 242;
    --bs-body-bg:             #12141f;
    --bs-secondary-color:     #8890b0;
    --bs-secondary-color-rgb: 136, 144, 176;
    --bs-tertiary-color:      #626888;
    --bs-emphasis-color:      #f0f2ff;
    --bs-heading-color:       #e4e6f2;
    --bs-link-color:          #D4AF6B;
    --bs-link-hover-color:    #e8c87a;
    --bs-border-color:        #262940;
    --bs-secondary-bg:        #1a1c2b;
    --bs-tertiary-bg:         #12141f;
}

/* Smooth transition when switching theme */
html { transition: background-color 0.25s, color 0.25s; }

/* Override inline background injected by admin settings */
[data-theme="dark"] body {
    background-color: #12141f !important;
    background-image: none !important;
    color: #e4e6f2;
}

/* Headings & paragraphs */
[data-theme="dark"] h1,[data-theme="dark"] h2,[data-theme="dark"] h3,
[data-theme="dark"] h4,[data-theme="dark"] h5,[data-theme="dark"] h6 { color: var(--neutral-800); }
[data-theme="dark"] p { color: var(--neutral-700); }

/* card-altered */
[data-theme="dark"] .card-altered { color: var(--neutral-700); }

/* Links */
[data-theme="dark"] a { color: #D4AF6B; }
[data-theme="dark"] a:hover { color: #e8c87a; }

/* Header/footer: use dark frosted glass instead of sand */
[data-theme="dark"] body.has-bg .site-header,
[data-theme="dark"] .site-header {
    background: rgba(18, 20, 31, 0.92) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
[data-theme="dark"] body.has-bg .site-footer,
[data-theme="dark"] .site-footer {
    background: #1a1c2b !important;
    backdrop-filter: none;
}

/* Hero: dark fallback gradient when no banner image is set.
   No !important so that an inline background-image (banner) still shows. */
[data-theme="dark"] .hero {
    background: linear-gradient(135deg, #0c0d16 0%, #1a1c2b 50%, #0f1020 100%);
}
[data-theme="dark"] .hero h1 { color: #e4e6f2; }
[data-theme="dark"] .hero p  { color: #b8bdd4; }

/* Bootstrap dropdown */
[data-theme="dark"] .dropdown-menu {
    background-color: var(--sand-200);
    border-color: var(--sand-300);
}
[data-theme="dark"] .dropdown-item { color: var(--neutral-700); }
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus { background-color: var(--sand-300); color: var(--neutral-800); }
[data-theme="dark"] .dropdown-item.active { background-color: var(--primary-400); color: #12141f; }

/* Bootstrap forms */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-check-input {
    background-color: var(--sand-200);
    border-color: var(--sand-300);
    color: var(--neutral-800);
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: var(--sand-200);
    color: var(--neutral-800);
}
[data-theme="dark"] .form-text { color: var(--neutral-500); }
[data-theme="dark"] .form-check-input:checked { background-color: var(--primary-400); border-color: var(--primary-400); }

/* Bootstrap alerts */
[data-theme="dark"] .alert {
    background-color: var(--sand-200) !important;
    border-color: var(--sand-300) !important;
    color: var(--neutral-700) !important;
}
[data-theme="dark"] .alert-success {
    background-color: #141e20 !important;
    border-color: #1e3830 !important;
    color: #7abfa8 !important;
}
[data-theme="dark"] .alert-danger {
    background-color: #1e1420 !important;
    border-color: #381e30 !important;
    color: #c48fa8 !important;
}

/* Bootstrap modals */
[data-theme="dark"] .modal-content { background-color: var(--sand-100); border-color: var(--sand-300); }
[data-theme="dark"] .modal-body    { background-color: var(--sand-100) !important; color: var(--neutral-700); }
[data-theme="dark"] .modal-header  { border-bottom-color: var(--sand-300); }
[data-theme="dark"] .modal-footer  { border-top-color: var(--sand-300); }

/* Bootstrap form elements */
[data-theme="dark"] .form-label  { color: var(--neutral-700); }
[data-theme="dark"] .form-text   { color: var(--neutral-500); }
[data-theme="dark"] .input-group-text {
    background-color: var(--sand-200);
    border-color: var(--sand-300);
    color: var(--neutral-700);
}

/* Bootstrap badges */
[data-theme="dark"] .badge.bg-secondary { background-color: var(--sand-300) !important; color: var(--neutral-700); }
[data-theme="dark"] .badge.bg-primary   { background-color: var(--primary-500) !important; }
[data-theme="dark"] .badge.text-bg-secondary { background-color: var(--sand-300) !important; color: var(--neutral-700); }

/* Bootstrap list-group */
[data-theme="dark"] .list-group-item {
    background-color: var(--sand-100);
    border-color: var(--sand-300);
    color: var(--neutral-700);
}
[data-theme="dark"] .list-group-item:hover { background-color: var(--sand-200); }

/* Bootstrap buttons */
[data-theme="dark"] .btn-outline-secondary {
    color: var(--neutral-600);
    border-color: var(--sand-300);
}
[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--sand-300);
    color: var(--neutral-800);
    border-color: var(--sand-300);
}
[data-theme="dark"] .btn-close { filter: invert(1) hue-rotate(180deg); }

/* Bootstrap tables */
[data-theme="dark"] .table { color: var(--neutral-700); --bs-table-bg: transparent; }
[data-theme="dark"] .table > :not(caption) > * > * { color: var(--neutral-700); border-bottom-color: var(--sand-300); }

/* Active / primary states — violet-blue accent in dark mode (replaces flashy gold) */
[data-theme="dark"] .btn-primary-altered {
    background: #5a5fc8;
    border-color: #4e53b8;
    color: #e8eaff;
}
[data-theme="dark"] .btn-primary-altered:hover {
    background: #4e53b8;
    border-color: #4349a6;
    color: #e8eaff;
}
[data-theme="dark"] .filter-toggle.active {
    background: #5a5fc8;
    border-color: #5a5fc8;
    color: #e8eaff;
}
[data-theme="dark"] .cat-filter a.active,
[data-theme="dark"] .cat-filter a:hover {
    background: #5a5fc8;
    border-color: #5a5fc8;
    color: #e8eaff;
}
[data-theme="dark"] .pagination-altered .page-link:hover,
[data-theme="dark"] .pagination-altered .active .page-link {
    background: #5a5fc8;
    border-color: #5a5fc8;
    color: #e8eaff;
}
[data-theme="dark"] .altered-navbar .nav-link:hover,
[data-theme="dark"] .altered-navbar .nav-link.active {
    background-color: #5a5fc8;
    color: #e8eaff;
}
[data-theme="dark"] .badge-category {
    background: #5a5fc8;
    color: #e8eaff;
}
[data-theme="dark"] .badge-category:hover {
    background: #4e53b8;
    color: #e8eaff;
}
[data-theme="dark"] .badge-source {
    background: var(--sand-300);
    color: var(--neutral-600);
}
[data-theme="dark"] .dropdown-item.active { background-color: #5a5fc8; color: #e8eaff; }
[data-theme="dark"] .form-check-input:checked { background-color: #5a5fc8; border-color: #5a5fc8; }
[data-theme="dark"] .btn-hero {
    background: #5a5fc8;
    border-color: #4e53b8;
    color: #e8eaff;
}
[data-theme="dark"] .btn-hero:hover {
    background: #4e53b8;
    border-color: #4349a6;
    color: #e8eaff;
}
[data-theme="dark"] .btn-login {
    background: #5a5fc8;
    border-color: #4e53b8;
    color: #e8eaff;
}
[data-theme="dark"] .btn-login:hover { background: #4e53b8; color: #e8eaff; }
[data-theme="dark"] .btn-user-badge {
    background: #5a5fc8;
    border-color: #4e53b8;
    color: #e8eaff;
}
[data-theme="dark"] .btn-user-badge:hover,
[data-theme="dark"] .btn-user-badge:focus { background: #4e53b8; color: #e8eaff; }

/* News card hover shadow */
[data-theme="dark"] .news-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.5); }

/* Theme toggle button */
.btn-theme-toggle {
    font-size: 0.78rem;
    color: var(--neutral-500);
    background: transparent;
    border: 1px solid var(--sand-300);
    border-radius: 0.4rem;
    padding: 0.2rem 0.6rem;
    transition: background 0.15s;
    cursor: pointer;
    line-height: 1.5;
}
.btn-theme-toggle:hover { background: var(--sand-300); color: var(--neutral-700); }

/* Theme toggle button — navbar variant */
.btn-theme-toggle-ac {
    font-size: 0.9rem;
    color: var(--neutral-600);
    background: transparent;
    border: none;
    border-radius: 0.4rem;
    padding: 0.25rem 0.45rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.btn-theme-toggle-ac:hover { background: var(--sand-300); color: var(--neutral-800); }
[data-theme="dark"] .btn-theme-toggle-ac { color: var(--neutral-400); }
[data-theme="dark"] .btn-theme-toggle-ac:hover { background: var(--sand-300); color: var(--neutral-700); }

/* ---- Card filter controls (shared: cards.php, deckbuilder.php, decks.php) ---- */
.filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-label {
    font-size: .7rem;
    font-weight: 700;
    color: var(--neutral-400);
    text-transform: uppercase;
    letter-spacing: .06em;
    min-width: 56px;
    flex-shrink: 0;
}
.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--neutral-200);
    background: transparent;
    color: var(--neutral-600);
    font-size: .82rem;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
    white-space: nowrap;
}
.filter-toggle.active { background: var(--primary-400); border-color: var(--primary-400); color: #fff; }
.filter-toggle-soon { opacity: .45; cursor: not-allowed; }
.filter-toggle img { width: 18px; height: 18px; object-fit: contain; }

/* ---- Set quick-filter image buttons ---- */
.filter-toggle.set-qf-btn {
    position: relative;
    display: flex;
    overflow: hidden;
    width: 82px;
    height: 82px;
    flex: 0 0 82px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    background-clip: padding-box;
    background-color: var(--neutral-200);
    border: 2px solid transparent;
    padding: 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    color: #fff;
    white-space: normal;
    transition: border-color .15s;
}
.filter-toggle.set-qf-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.62);
    transition: background .2s;
    pointer-events: none;
}
.filter-toggle.set-qf-btn:hover::before { background: rgba(0,0,0,.35); }
.filter-toggle.set-qf-btn.active { background-color: var(--neutral-200); border-color: var(--primary-400); color: #fff; }
.filter-toggle.set-qf-btn.active::before { background: rgba(0,0,0,.08); }
[data-theme="dark"] .filter-toggle.set-qf-btn { background-color: var(--neutral-700, #374151); }
[data-theme="dark"] .filter-toggle.set-qf-btn.active { background-color: var(--neutral-700, #374151); border-color: var(--primary-400); color: #fff; }
.set-qf-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 4px 2px;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,.9);
}
.set-qf-inner i { font-size: 1.1rem; line-height: 1; }
.set-qf-inner > span { font-size: .6rem; font-weight: 700; line-height: 1.2; text-align: center; }

.ts-filters-row {
    display: grid;
    gap: 10px;
    margin-bottom: .5rem;
}

/* ---- TomSelect overrides ---- */
.ts-wrapper.multi .ts-control { background:var(--sand-50);border:1px solid var(--sand-200);border-radius:6px;padding:3px 6px;min-height:31px;cursor:pointer;gap:4px; }
.ts-wrapper.multi .ts-control:focus-within { border-color:var(--primary-400);box-shadow:0 0 0 .2rem rgba(201,168,76,.2); }
.ts-wrapper.multi .ts-control .item { background:var(--primary-400);border:none;color:var(--neutral-800);font-size:.78rem;font-weight:600;border-radius:4px;padding:1px 6px; }
.ts-wrapper.multi .ts-control .item .remove { color:var(--neutral-800);border-left:1px solid rgba(0,0,0,.15);margin-left:4px;padding-left:4px; }
/* !important needed: tom-select.bootstrap5.css loads after this file and overwrites single background */
.ts-wrapper.single .ts-control { background:var(--sand-50)!important;background-image:none!important;border:1px solid var(--sand-200);border-radius:6px;padding:3px 6px;min-height:31px;cursor:pointer;gap:4px; }
.ts-wrapper.single .ts-control:focus-within { border-color:var(--primary-400);box-shadow:0 0 0 .2rem rgba(201,168,76,.2); }
.ts-wrapper.single .ts-control .item { background:none;border:none;color:var(--neutral-700);font-size:.88rem;font-weight:normal;border-radius:0;padding:0; }
.ts-wrapper .ts-control input { cursor:pointer;width:0!important;flex:0!important;padding:0!important; }
.ts-dropdown { background:var(--sand-50);border:1px solid var(--sand-200);border-radius:6px;box-shadow:0 4px 16px rgba(0,0,0,.15); }
.ts-dropdown .option { color:var(--neutral-700);padding:6px 10px;font-size:.85rem; }
.ts-dropdown .option:hover,.ts-dropdown .option.active { background:var(--sand-100);color:var(--neutral-800); }
.ts-dropdown .option.selected { background:rgba(201,168,76,.15); }

/* =========================================================
   Generic tab toggle  (.ac-tab-toggle + .btn-toggle)
   Used in: collection.php, deck.php, deckbuilder.php
   ========================================================= */
.ac-tab-toggle { display:flex; gap:6px; margin-bottom:.75rem; }
.ac-tab-toggle .btn-toggle { padding:5px 14px; border-radius:6px; font-size:.82rem; font-weight:600; border:1px solid var(--neutral-300); background:transparent; color:var(--neutral-500); cursor:pointer; transition:background .12s,color .12s,border-color .12s; }
.ac-tab-toggle .btn-toggle.active { background:var(--primary-400); border-color:var(--primary-400); color:#fff; }

/* =========================================================
   Iframe page  (iframe.php)
   ========================================================= */
#iframe-wrap { position:relative; width:100%; height:calc(100vh - var(--navbar-height,64px)); overflow:hidden; }
#iframe-wrap iframe { display:block; width:100%; height:100%; border:none; }
#iframe-bar { display:flex; align-items:center; gap:10px; padding:6px 16px; background:var(--sand-100); border-bottom:1px solid var(--sand-300); font-size:.78rem; color:var(--neutral-500); }
#iframe-bar a { color:var(--primary-500); text-decoration:none; display:inline-flex; align-items:center; gap:4px; }
#iframe-bar a:hover { text-decoration:underline; }
#iframe-loader { position:absolute; inset:0; background:var(--sand-50); display:flex; align-items:center; justify-content:center; z-index:10; flex-direction:column; gap:12px; color:var(--neutral-500); font-size:.9rem; }

/* =========================================================
   Card detail page  (card.php)
   ========================================================= */
.card-view-img-wrap { position:sticky; top:80px; text-align:center; }
.card-view-img { max-width:300px; width:100%; border-radius:10px; box-shadow:0 8px 32px rgba(0,0,0,.18); }
.card-view-img-wrap altered-card { display:block; max-width:300px; margin:0 auto; border-radius:10px; overflow:hidden; }
.card-stat-row { display:flex; align-items:center; gap:.5rem; padding:.5rem 0; border-bottom:1px solid var(--sand-200); font-size:.9rem; }
.card-stat-row:last-child { border-bottom:none; }
.card-stat-label { color:var(--neutral-500); min-width:140px; font-size:.85rem; flex-shrink:0; }
.card-stat-val { font-weight:600; color:var(--neutral-800); }
.power-pip { display:inline-flex; align-items:center; gap:.3rem; background:var(--sand-200); border-radius:.4rem; padding:.15rem .55rem; font-size:.88rem; font-weight:700; }
.card-section-label { font-size:.75rem; font-weight:700; text-transform:uppercase; letter-spacing:.07em; color:var(--neutral-400); margin-bottom:.5rem; }
.effect-hl { color:#C37424; }
/* Bootstrap nav-tabs override for card detail page */
.nav-tabs { border-bottom:2px solid var(--sand-200); gap:.2rem; flex-wrap:nowrap; }
.nav-tabs .nav-item { flex:1 1 0; min-width:0; }
.nav-tabs .nav-link { display:block; width:100%; text-align:center; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--neutral-500); background:transparent; border:2px solid transparent; border-radius:.5rem .5rem 0 0; padding:.45rem .6rem; font-size:.85rem; font-weight:600; margin-bottom:-2px; transition:color .15s,background .15s; }
.nav-tabs .nav-link:hover:not(.active) { color:var(--neutral-700); background:var(--sand-100); border-color:var(--sand-200) var(--sand-200) transparent; }
.nav-tabs .nav-link.active { color:var(--neutral-800); background:var(--sand-50); border-top:2px solid var(--primary-400); border-left:2px solid var(--sand-200); border-right:2px solid var(--sand-200); border-bottom:2px solid var(--sand-50); }

/* Skeleton loading placeholders */
.card-skeleton { background:var(--sand-200); border-radius:4px; animation:card-skeleton-pulse 1.4s ease-in-out infinite; }
@keyframes card-skeleton-pulse { 0%,100% { opacity:1; } 50% { opacity:.45; } }

/* =========================================================
   Cards browser  (cards.php)
   ========================================================= */
.cards-grid { display:grid; grid-template-columns:repeat(var(--cards-cols,4),1fr); gap:10px; }
@media (max-width:575px) { .cards-grid { grid-template-columns:repeat(var(--cards-mobile-cols,2),1fr); gap:6px; } }
.card-img-wrap { position:relative; cursor:pointer; min-width:0; overflow:hidden; background:url('/assets/img/ALT_OFFICIAL_CARDBACK.png') center/cover no-repeat var(--neutral-100); border-radius:8px; }
.card-img-wrap img, .card-img-wrap altered-card { display:block; width:100%; border-radius:8px; overflow:hidden; }
.card-img-wrap img { aspect-ratio:63.5/88; object-fit:cover; background:transparent; transition:transform .15s ease; }
.card-img-wrap altered-card { aspect-ratio:63.5/88; }
.card-img-wrap:hover img, .card-img-wrap:hover altered-card { transform:scale(1.03); }
.card-item { min-width:0; }
.card-name { font-size:.82rem; font-weight:600; text-align:center; margin-bottom:2px; color:var(--neutral-600); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; padding:0 2px; }
.card-coll-badge { position:absolute; bottom:5px; left:5px; background:rgba(0,0,0,.72); color:#fff; font-size:.65rem; font-weight:700; border-radius:5px; padding:1px 4px; pointer-events:none; z-index:2; transition:opacity .15s; }
.card-img-wrap:hover .card-coll-badge { opacity:0; }
.card-coll-bar { position:absolute; bottom:0; left:0; right:0; z-index:3; display:flex; align-items:center; justify-content:center; gap:6px; background:rgba(0,0,0,.65); padding:4px 6px; border-radius:0 0 8px 8px; opacity:0; pointer-events:none; transition:opacity .15s; }
.card-img-wrap:hover .card-coll-bar { opacity:1; pointer-events:auto; }
.card-coll-btn { border:none; background:rgba(255,255,255,.18); color:#fff; border-radius:4px; width:22px; height:22px; font-size:1rem; line-height:1; cursor:pointer; flex-shrink:0; padding:0; display:flex; align-items:center; justify-content:center; }
.card-coll-btn:hover:not(:disabled) { background:rgba(255,255,255,.35); }
.card-coll-btn:disabled { opacity:.4; cursor:default; }
.card-coll-qty { color:#fff; font-weight:700; font-size:.8rem; min-width:1.4em; text-align:center; }

/* =========================================================
   Decks list page  (decks.php)
   ========================================================= */
.deck-search-wrap { position:relative; display:inline-flex; align-items:center; }
.deck-search-wrap .deck-search-icon { position:absolute; left:8px; color:var(--neutral-300); font-size:.8rem; pointer-events:none; }
.deck-search-wrap input { padding-left:26px; }
.decks-tabs { display:flex; border-bottom:2px solid var(--sand-200); }
.decks-tab { background:none; border:none; border-bottom:3px solid transparent; padding:9px 20px; font-size:.9rem; font-weight:600; color:var(--neutral-500); cursor:pointer; margin-bottom:-2px; transition:color .15s,border-color .15s; }
.decks-tab.active { color:var(--primary-500); border-bottom-color:var(--primary-400); }
.decks-tab:hover:not(.active) { color:var(--neutral-700); }

/* =========================================================
   Deck detail page  (deck.php)
   ========================================================= */
.deck-cards-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; }
@media (min-width:576px) { .deck-cards-grid { grid-template-columns:repeat(3,1fr); } }
@media (min-width:900px) { .deck-cards-grid { grid-template-columns:repeat(4,1fr); } }
@media (min-width:1200px) { .deck-cards-grid { grid-template-columns:repeat(5,1fr); } }
.deck-card-wrap { position:relative; background:url('/assets/img/ALT_OFFICIAL_CARDBACK.png') center/cover no-repeat var(--neutral-100); border-radius:8px; cursor:pointer; }
.deck-card-qty { position:absolute; top:6px; right:6px; background:rgba(0,0,0,.78); color:#fff; font-size:.88rem; font-weight:700; padding:3px 9px; border-radius:5px; border:1px solid rgba(255,255,255,.25); pointer-events:none; z-index:1; }
.deck-card-img { display:block; width:100%; border-radius:8px; overflow:hidden; aspect-ratio:63.5/88; object-fit:cover; background:transparent; }
.deck-card-wrap altered-card { display:block; width:100%; border-radius:8px; overflow:hidden; aspect-ratio:63.5/88; }
.deck-type-section { margin-bottom:1.5rem; }
.deck-type-header { font-size:.78rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--neutral-400); margin-bottom:.5rem; display:flex; align-items:center; gap:6px; }
.decklist-row { display:flex; align-items:center; gap:8px; padding:5px 0; border-bottom:1px solid var(--neutral-100); cursor:pointer; }
.decklist-row:last-child { border-bottom:none; }
.decklist-row:hover .decklist-name { color:var(--primary-600); text-decoration:underline; }
.decklist-qty { font-size:.82rem; font-weight:700; color:var(--neutral-500); min-width:22px; }
.decklist-cost { font-size:.78rem; font-weight:600; background:var(--neutral-100); border-radius:4px; padding:1px 6px; min-width:22px; text-align:center; color:var(--neutral-600); }
.decklist-faction { display:flex; align-items:center; width:16px; flex-shrink:0; }
.decklist-faction img { width:16px; height:16px; object-fit:contain; }
.decklist-name { font-size:.9rem; color:var(--neutral-700); flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.decklist-stats { display:flex; align-items:center; gap:6px; flex-shrink:0; }
.decklist-stat { display:flex; align-items:center; gap:2px; font-size:.75rem; font-weight:600; color:var(--neutral-500); min-width:28px; justify-content:flex-end; line-height:1; }
.decklist-stat i, .decklist-stat img { vertical-align:middle; }
.decklist-stat img { width:13px; height:13px; object-fit:contain; flex-shrink:0; }
.deck-content-layout { display:grid; grid-template-columns:1fr 240px; gap:20px; align-items:start; }
@media (max-width:900px) { .deck-content-layout { grid-template-columns:1fr; } }
.deck-sidebar { position:sticky; top:80px; }
.deck-stats-col { display:flex; flex-direction:column; gap:12px; }
.deck-stat-card { background:var(--sand-100); border-radius:10px; padding:12px 14px; }
.deck-stat-title { font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--neutral-400); margin-bottom:8px; }
.stat-bar-row { display:flex; align-items:center; gap:6px; margin-bottom:4px; }
.stat-bar-label { font-size:.74rem; color:var(--neutral-500); min-width:20px; text-align:center; }
.stat-bar-track { flex:1; background:var(--neutral-100); border-radius:3px; height:10px; overflow:hidden; }
.stat-bar-fill { height:100%; border-radius:3px; background:var(--primary-400); }
.stat-bar-val { font-size:.72rem; color:var(--neutral-400); min-width:22px; text-align:right; }
.vcurve-counts { display:flex; gap:3px; margin-bottom:2px; }
.vcurve-counts span { flex:1; text-align:center; font-size:.6rem; color:var(--neutral-500); line-height:1; min-height:.75rem; }
.vcurve-bars { display:flex; align-items:flex-end; gap:3px; height:48px; }
.vcurve-bar { flex:1; border-radius:2px 2px 0 0; min-height:0; }
.vcurve-labels { display:flex; gap:3px; margin-top:3px; }
.vcurve-labels span { flex:1; text-align:center; font-size:.6rem; color:var(--neutral-400); line-height:1; }

/* =========================================================
   Deck builder  (deckbuilder.php)
   ========================================================= */
#db-hero-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; }
@media (min-width:576px) { #db-hero-grid { grid-template-columns:repeat(3,1fr); } }
.db-layout { display:grid; grid-template-columns:1fr 360px; gap:16px; align-items:start; }
.db-panel-left  { min-width:0; }
.db-panel-right { position:sticky; top:80px; height:calc(100vh - 80px); overflow-y:auto; padding-bottom:1.5rem; }
@media (max-width:991px) {
    .db-layout { display:block; }
    .db-panel-right { position:static; }
    .db-tab-pane { display:none; }
    .db-tab-pane.active { display:block; }
}
@media (min-width:992px) {
    .db-mobile-tabs { display:none !important; }
    .db-tab-pane { display:block !important; }
}
.db-mobile-tabs { display:flex; border-bottom:2px solid var(--sand-200); margin-bottom:12px; }
.db-mobile-tab { flex:1; text-align:center; padding:10px 6px; cursor:pointer; font-weight:600; font-size:.88rem; border:none; background:none; border-bottom:3px solid transparent; margin-bottom:-2px; color:var(--neutral-500); transition:color .15s; }
.db-mobile-tab.active { border-bottom-color:var(--primary-400); color:var(--primary-500); }
.cards-grid-db { display:grid; grid-template-columns:repeat(var(--db-cols,3),1fr); gap:8px; }
@media (max-width:575px) { .cards-grid-db { grid-template-columns:repeat(2,1fr); } }
.db-card-wrap { position:relative; cursor:pointer; min-width:0; overflow:hidden; background:url('/assets/img/ALT_OFFICIAL_CARDBACK.png') center/cover no-repeat var(--neutral-100); border-radius:7px; }
.db-card-img { display:block; width:100%; border-radius:7px; overflow:hidden; aspect-ratio:63.5/88; object-fit:cover; background:transparent; transition:transform .12s; }
.db-card-wrap altered-card { display:block; width:100%; border-radius:7px; overflow:hidden; aspect-ratio:63.5/88; transition:transform .12s; }
.db-card-wrap:hover .db-card-img, .db-card-wrap:hover altered-card { transform:scale(1.04); }
.db-card-qty-badge { position:absolute; top:5px; right:5px; background:rgba(0,0,0,.82); color:#fff; font-size:.8rem; font-weight:700; padding:2px 8px; border-radius:4px; border:1px solid rgba(255,255,255,.25); pointer-events:none; }
.db-card-name { font-size:.72rem; font-weight:600; text-align:center; margin-bottom:2px; color:var(--neutral-600); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; padding:0 2px; }
.db-card-add-overlay { position:absolute; inset:0; background:rgba(0,0,0,.45); display:flex; align-items:center; justify-content:center; opacity:0; transition:opacity .12s; border-radius:7px; }
.db-card-wrap:hover .db-card-add-overlay { opacity:1; }
.db-card-add-overlay span { background:rgba(255,255,255,.92); color:#111; font-size:.75rem; font-weight:700; padding:4px 12px; border-radius:20px; }
.db-card-btn-group { position:absolute; bottom:5px; right:5px; }
.deck-list-item { display:flex; align-items:center; gap:8px; padding:5px 0; border-bottom:1px solid var(--neutral-100); min-width:0; }
.deck-list-item:last-child { border-bottom:none; }
.deck-list-qty { display:flex; align-items:center; gap:4px; flex-shrink:0; }
.deck-list-qty button { width:22px; height:22px; border-radius:50%; border:1px solid var(--neutral-200); background:var(--sand-50); color:var(--neutral-600); font-size:.85rem; line-height:1; cursor:pointer; display:flex; align-items:center; justify-content:center; padding:0; transition:background .1s; }
.deck-list-qty button:hover { background:var(--neutral-100); }
.deck-list-qty .qty-num { min-width:18px; text-align:center; font-size:.82rem; font-weight:700; color:var(--neutral-700); }
.deck-list-name { flex:1; min-width:0; font-size:.82rem; color:var(--neutral-700); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.deck-list-gem { width:13px; height:13px; object-fit:contain; flex-shrink:0; }
.db-card-coll-badge { position:absolute; bottom:5px; left:5px; background:rgba(0,0,0,.72); color:#fff; font-size:.65rem; font-weight:700; border-radius:5px; padding:1px 4px; pointer-events:none; z-index:2; }
.deck-list-stockwarn { display:inline-flex; align-items:center; justify-content:center; width:15px; height:15px; border-radius:50%; background:#f59e0b; color:#fff; font-size:.55rem; flex-shrink:0; margin-left:2px; }
.deck-list-violation { display:inline-flex; align-items:center; justify-content:center; width:15px; height:15px; border-radius:50%; background:#ef4444; color:#fff; font-size:.6rem; font-weight:800; flex-shrink:0; margin-left:auto; cursor:help; }
.deck-list-banned    { display:inline-flex; align-items:center; justify-content:center; width:15px; height:15px; flex-shrink:0; margin-left:2px; color:#ef4444; font-size:.65rem; cursor:help; }
.deck-list-suspended { display:inline-flex; align-items:center; justify-content:center; width:15px; height:15px; flex-shrink:0; margin-left:2px; color:#f59e0b; font-size:.65rem; cursor:help; }
.hero-banner { border-radius:8px; overflow:hidden; background:var(--neutral-100); min-height:72px; display:flex; align-items:center; gap:10px; padding:8px 12px; cursor:pointer; transition:opacity .15s; }
.hero-banner:hover { opacity:.85; }
.db-deck-tab { background:none; border:none; border-bottom:2px solid transparent; padding:6px 12px; font-size:.78rem; font-weight:700; color:var(--neutral-400); cursor:pointer; margin-bottom:-1px; transition:color .12s,border-color .12s; }
.db-deck-tab.active { color:var(--primary-500); border-bottom-color:var(--primary-400); }
.db-stat-section-title { font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--neutral-400); margin-bottom:6px; }
.db-stat-bar-row { display:flex; align-items:center; gap:5px; margin-bottom:5px; }
.db-stat-bar-lbl { font-size:.72rem; color:var(--neutral-500); min-width:20px; text-align:center; }
.db-stat-bar-track { flex:1; background:var(--neutral-100); border-radius:3px; height:8px; overflow:hidden; }
.db-stat-bar-fill { height:100%; border-radius:3px; background:var(--primary-400); transition:width .2s; }
.db-stat-bar-val { font-size:.7rem; color:var(--neutral-400); min-width:20px; text-align:right; }
.db-vcurve-counts { display:flex; gap:3px; margin-bottom:2px; }
.db-vcurve-counts span { flex:1; text-align:center; font-size:.6rem; color:var(--neutral-500); line-height:1; min-height:.75rem; }
.db-vcurve-bars { display:flex; align-items:flex-end; gap:3px; height:44px; }
.db-vcurve-bar { flex:1; border-radius:2px 2px 0 0; min-height:0; transition:height .2s; }
.db-vcurve-labels { display:flex; gap:3px; margin-top:3px; margin-bottom:12px; }
.db-vcurve-labels span { flex:1; text-align:center; font-size:.6rem; color:var(--neutral-400); line-height:1; }
.db-deckgrid { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; margin-bottom:4px; }
.db-deckgrid-card { position:relative; cursor:pointer; border-radius:7px; overflow:hidden; transition:transform .12s; }
.db-deckgrid-card:hover { transform:scale(1.04); }
.db-deckgrid-card img { display:block; width:100%; aspect-ratio:63.5/88; object-fit:cover; border-radius:7px; }
.db-deckgrid-card altered-card { display:block; width:100%; aspect-ratio:63.5/88; overflow:hidden; border-radius:7px; }
.db-deckgrid-qty { position:absolute; top:3px; right:3px; background:rgba(0,0,0,.82); color:#fff; font-size:.65rem; font-weight:700; padding:1px 5px; border-radius:3px; pointer-events:none; border:1px solid rgba(255,255,255,.2); }
.db-deckgrid-type { font-size:.65rem; font-weight:700; color:var(--neutral-400); text-transform:uppercase; letter-spacing:.05em; padding:8px 0 3px; }
.db-decklist-row { display:flex; align-items:center; gap:6px; padding:4px 0; border-bottom:1px solid var(--neutral-100); font-size:.8rem; cursor:pointer; }
.db-decklist-row:last-child { border-bottom:none; }
.db-decklist-row:hover { background:var(--sand-100); }
.db-decklist-qty { font-weight:700; color:var(--neutral-700); min-width:18px; text-align:center; flex-shrink:0; }
.db-decklist-cost { color:var(--neutral-400); min-width:14px; text-align:center; flex-shrink:0; font-size:.75rem; }
.db-decklist-name { flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--neutral-700); }
.db-decklist-stats { display:flex; align-items:center; gap:3px; color:var(--neutral-500); font-size:.72rem; flex-shrink:0; white-space:nowrap; }
