* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    color: white;
    background:
        radial-gradient(circle at top, rgba(255, 120, 40, 0.25), transparent 35%),
        radial-gradient(circle at bottom left, rgba(40, 120, 255, 0.25), transparent 35%),
        linear-gradient(135deg, #0d1117, #050608);
}

a {
    color: #76a9ff;
}

button,
.menu-button {
    cursor: pointer;
    font-family: inherit;
}

.error {
    background: rgba(180, 40, 40, 0.25);
    border: 1px solid rgba(255, 80, 80, 0.5);
    color: #ffb3b3;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.success {
    background: rgba(40, 160, 80, 0.22);
    border: 1px solid rgba(80, 220, 120, 0.45);
    color: #b7ffc7;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.table-filters {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.table-filters select,
.table-filters input,
.table-filters button,
.table-filters a {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid rgba(120, 170, 255, 0.22);
    background: rgba(255,255,255,0.08);
    color: #ffffff;
    font-weight: 600;
}

.table-filters select {
    appearance: none;
    cursor: pointer;
    background:
        linear-gradient(145deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
}

.table-filters select option {
    background: #111827;
    color: #ffffff;
}

.table-filters button,
.table-filters a {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
}

.table-filters button {
    background: linear-gradient(145deg, rgba(70,120,255,0.35), rgba(40,70,160,0.25));
}

.table-filters a {
    background: rgba(255,255,255,0.08);
}

.table-filters button:hover,
.table-filters a:hover,
.table-filters select:hover {
    border-color: rgba(140,190,255,0.45);
    background-color: rgba(255,255,255,0.12);
}

@media (max-width: 850px) {
    .table-filters {
        grid-template-columns: 1fr;
    }
}

.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease;
}

.sortable:hover {
    color: #ffffff;
}

.stat-col {
    width: 52px;
    min-width: 52px;
    max-width: 52px;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
}

th.stat-col {
    font-size: 18px;
    padding-left: 4px;
    padding-right: 4px;
}

tfoot td {
    border-top: 1px solid rgba(255,255,255,0.16);
    font-weight: bold;
}

@media (max-width: 850px) {
    .table-filters {
        grid-template-columns: 1fr;
    }
}

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

input,
select,
textarea,
button {
    max-width: 100%;
}

@media (max-width: 600px) {
    body {
        background-attachment: fixed;
    }

    .error,
    .success {
        font-size: 14px;
    }
}

.realmfall-page {
    position: relative;
    min-height: 100vh;
    padding: 30px;
}

.realmfall-page-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
}

.realmfall-page::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;

    background:
        radial-gradient(
            circle,
            rgba(0,0,0,.15) 0%,
            rgba(0,0,0,.45) 70%,
            rgba(0,0,0,.8) 100%
        );
}

.realmfall-page-overlay {
    max-width: 1700px;
    margin: 0 auto;
}

.realmfall-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;

    margin-bottom: 25px;
}

.realmfall-page-title {
    flex: 1;
}

.realmfall-page-title h1 {
    margin: 0;
    color: #f7d98d;
    font-size: clamp(36px, 4vw, 54px);

    text-shadow:
        0 2px 4px #000,
        0 0 20px rgba(213,168,90,.3);
}

.realmfall-page-title p {
    margin: 8px 0 0;
    color: rgba(255,255,255,.85);
    font-size: 18px;
}

.realmfall-page-logo {
    width: min(420px, 35vw);
    height: auto;

    flex-shrink: 0;

    filter:
        drop-shadow(0 4px 10px rgba(0,0,0,.7));
}

@media (max-width: 900px) {

    .realmfall-page-header {
        flex-direction: column-reverse;
        text-align: center;
        gap: 12px;
    }

    .realmfall-page-logo {
        width: min(320px, 80vw);
    }

    .realmfall-page-title h1 {
        font-size: 36px;
    }

}


/* Reusable game card display */
.collection-panel {
    background: rgba(5,10,16,.82);
    border: 1px solid rgba(213,168,90,.25);
    border-radius: 18px;
    padding: 24px;

    backdrop-filter: blur(10px);

    box-shadow:
        0 0 40px rgba(0,0,0,.55),
        inset 0 0 30px rgba(213,168,90,.04);
}

.card-collection-filters {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.collection-count {
    text-align: center;
    margin: 20px 0;
    color: #f7d98d;
    font-size: 18px;
    font-weight: 700;
}

.empty-card-message {
    padding: 18px;
    border-radius: 12px;
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.78);
}

@keyframes gameCardPlatinumShine {
    0%, 100% {
        text-shadow:
            0 0 6px rgba(217,245,255,0.75),
            0 2px 4px #000000;
    }
    50% {
        text-shadow:
            0 0 12px rgba(255,255,255,1),
            0 0 20px rgba(160,225,255,0.85),
            0 2px 4px #000000;
    }
}

@media (max-width: 1100px) {
    .card-collection-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .collection-panel {
        padding: 15px;
    }

    .card-collection-filters {
        grid-template-columns: 1fr;
    }
}


/* Fullscreen card preview on cards.php */
.game-card-grid .game-card,
.deck-builder-grid .game-card {
    cursor: zoom-in;
}

.game-card-grid .game-card:focus-visible,
.deck-builder-grid .game-card:focus-visible {
    outline: 3px solid rgba(245,197,66,0.95);
    outline-offset: 5px;
    border-radius: 16px;
}

body.card-fullscreen-open {
    overflow: hidden;
}

.card-fullscreen-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.86);
    backdrop-filter: blur(4px);
}

.card-fullscreen-overlay.is-open {
    display: flex;
}

.card-fullscreen-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-fullscreen-content {
    width: min(92vw, calc(94vh * 1039 / 1514), 520px);
    max-height: 94vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-fullscreen-content .game-card {
    width: min(92vw, calc(94vh * 1039 / 1514), 520px);
    max-width: none;
    max-height: 94vh;
    cursor: default;
}

.card-fullscreen-content .game-card-frame {
    width: 100%;
    height: auto;
    aspect-ratio: 1039 / 1514;
}

.card-fullscreen-close {
    position: fixed;
    top: 18px;
    right: 22px;
    z-index: 10000;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 999px;
    background: rgba(10, 15, 25, 0.92);
    color: #ffffff;
    font-size: 32px;
    line-height: 1;
    font-weight: 400;
    cursor: pointer;
}

.card-fullscreen-close:hover,
.card-fullscreen-close:focus-visible {
    background: rgba(255,255,255,0.16);
    outline: none;
}

@media (max-width: 700px) {
    .card-fullscreen-overlay {
        padding: 10px;
    }

    .card-fullscreen-content,
    .card-fullscreen-content .game-card {
        width: min(96vw, calc(92vh * 1039 / 1514), 440px);
    }

    .card-fullscreen-close {
        top: 10px;
        right: 10px;
    }
}

.overlay-close-x {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

/* ---------------------------------------------------------------------------
 * File uploads — styled site-wide so every "Choose File" control matches the
 * site's buttons and form fields. The field itself reads like a text input;
 * the browser's file-picker button is restyled to look like .dashboard-button.
 *
 * NOTE: the standard (::file-selector-button) and legacy WebKit
 * (::-webkit-file-upload-button) pseudo-elements are kept in SEPARATE rules on
 * purpose — grouping a selector a browser doesn't recognise makes it discard
 * the whole rule.
 * ------------------------------------------------------------------------- */
input[type="file"] {
    display: block;
    width: 100%;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: #d9e2f2;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
}

input[type="file"]:focus {
    outline: none;
    border-color: rgba(86, 184, 255, 0.6);
    background: rgba(255, 255, 255, 0.1);
}

input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #2364d2, #163b82);
    color: #fff;
    font-family: inherit;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease;
}
input[type="file"]::file-selector-button:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

input[type="file"]::-webkit-file-upload-button {
    margin-right: 12px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #2364d2, #163b82);
    color: #fff;
    font-family: inherit;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease;
}
input[type="file"]::-webkit-file-upload-button:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}
