:root {

    --bg: #0f172a;
    --header: #111827;

    --card: #1f2937;
    --card-hover: #273449;

    --border: #374151;

    --text: #f8fafc;
    --muted: #9ca3af;

    --accent: #93c5fd;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {

    margin: 0;

    background: var(--bg);

    color: var(--text);

    font-family:
        Inter,
        system-ui,
        sans-serif;
}

/*************************************************/
/* Header                                        */
/*************************************************/

header {

    background: var(--header);

    border-bottom: 1px solid #1f2937;

    padding: 24px 42px;

    display: flex;

    justify-content: space-between;

    align-items: center;
    gap: 20px;
}

.subtitle {

    text-transform: uppercase;

    letter-spacing: .18em;

    color: var(--accent);

    font-size: 12px;

    margin-bottom: 8px;
}

header h1 {

    margin: 0;

    font-size: 42px;

    font-weight: 800;
}

.header-intro {
    flex: 2;
    color: var(--muted);
    font-size: 17.5px;
    line-height: 1.3;
}

@media (max-width: 900px) {
    .header-intro {
        display: block;
        font-size: 15px;
        margin-left: 0;
        margin-right: 0;
        text-align: center;
    }

    .header-summary {
        width: 100%;
        align-items: center;
        text-align: center;
    }

    #summary,
    .vote-counter {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

#summary {

    color: #cbd5e1;

    font-size: 15px;

    margin-top: 8px;
    text-align: right;
}

.header-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.vote-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, .18);
    border: 1px solid rgba(147, 197, 253, .35);
    color: #bfdbfe;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
}

.header-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

.vs-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 999px;
    background: #2563eb; /* match primary button color */
    color: white;
    text-decoration: none;
    transition: transform .15s ease, opacity .15s ease, box-shadow .15s ease, background .12s ease;
}

.vs-link-btn:hover {
    transform: translateY(-2px);
    opacity: .98;
    background: #3b82f6;
}

/* VS icon styling */
.vs-icon {
    font-weight: 1000;
    font-size: 4.0rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: .12em;
    width: 132px;
    height: 74px;
    padding: 0 12px;
    border: 2px solid rgba(255, 255, 255, .8);
    border-radius: 299px;
    background: linear-gradient(90deg, #ff3d3d 0%, #ff9f1c 35%, #facc15 65%, #7dd3fc 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow:
        0 0 10px rgba(255, 255, 255, .45),
        0 2px 12px rgba(0, 0, 0, .25),
        0 12px 26px rgba(255, 148, 0, .24);
    box-shadow:
        0 0 0 4px rgba(255, 255, 255, .06),
        0 10px 24px rgba(59, 130, 246, .22);
}

.vs-link-btn:hover .vs-icon {
    box-shadow:
        0 0 0 5px rgba(255, 255, 255, .08),
        0 14px 28px rgba(59, 130, 246, .28);
}

main {
    max-width: 1260px;

    margin: 20px auto;

    padding: 0 16px;
}

#cardList {

    display: flex;

    flex-direction: column;

    gap: 14px;
}

/*************************************************/
/* Card                                          */
/*************************************************/

.card {

    display: grid;

    grid-template-columns:
        80px
        120px
        1fr
        auto;

    gap: 22px;

    align-items: center;

    background: var(--card);

    border: 1px solid var(--border);

    border-radius: 18px;

    padding: 18px;

    transition:
        background .15s,
        border-color .15s,
        transform .15s;
}

.card:hover {

    background: var(--card-hover);

    border-color: #4b5563;

    transform: translateY(-2px);
}

/*************************************************/
/* Rank                                          */
/*************************************************/

.rank {

    text-align: center;

    font-size: 24px;

    font-weight: 700;

    color: var(--accent);
}

/*************************************************/
/* Image                                         */
/*************************************************/

.card img {

    width: 110px;

    display: block;

    border-radius: 8px;

    box-shadow:
        0 6px 14px rgba(0,0,0,.35);
}

/*************************************************/
/* Info                                          */
/*************************************************/

.info {

    display: flex;

    flex-direction: column;

    justify-content: center;
}

.name {

    margin: 0 0 10px;

    font-size: 20px;

    font-weight: 700;
}

.name a {

    color: white;

    text-decoration: none;
}

.name a:hover {

    color: var(--accent);
}

.meta {

    color: var(--muted);

    font-size: 14px;

    line-height: 1.6;
}

/*************************************************/
/* Mana Symbols                                  */
/*************************************************/

.colors {

    display: flex;
    gap: 6px;
    margin: 10px 0;
}

.colors img {

    width: 24px;

    height: 24px;

    box-shadow: none;

    border-radius: 0;
}

/*************************************************/
/* Link                                          */
/*************************************************/

.scryfall {

    margin-top: 10px;

    font-size: 14px;
}

.scryfall a {

    color: var(--accent);

    text-decoration: none;
}

.scryfall a:hover {

    text-decoration: underline;
}

/*************************************************/
/* Filter Bar                                    */
/*************************************************/

#filterBar {

    display: flex;

    gap: 8px;

    margin-bottom: 16px;

    align-items: center;

    flex-wrap: wrap;
}

#filterInput {

    flex: 1;

    min-width: 260px;

    padding: 10px 14px;

    background: var(--card);

    border: 1px solid var(--border);

    border-radius: 8px;

    color: var(--text);

    font-size: 14px;

    font-family: inherit;

    outline: none;

    transition: border-color .15s;
}

#filterInput::placeholder {

    color: #6b7280;
}

#filterInput:focus {

    border-color: var(--accent);
}

.help-btn {

    width: 36px;

    height: 36px;

    display: flex;

    align-items: center;

    justify-content: center;

    border-radius: 50%;

    background: var(--card);

    border: 1px solid var(--border);

    color: var(--muted);

    font-size: 16px;

    font-weight: 700;

    cursor: pointer;

    transition:
        background .15s,
        border-color .15s,
        color .15s;
}

.help-btn:hover {

    background: var(--card-hover);

    border-color: var(--accent);

    color: var(--accent);
}

/*************************************************/
/* Filter Help                                   */
/*************************************************/

.filter-help {

    background: var(--card);

    border: 1px solid var(--border);

    border-radius: 12px;

    padding: 20px 24px;

    margin-bottom: 16px;

    font-size: 14px;

    line-height: 1.7;
}

.filter-help h3 {

    margin: 0 0 10px;

    font-size: 16px;

    color: var(--accent);
}

.filter-help p {

    margin: 0 0 14px;

    color: var(--muted);
}

.filter-help code {

    background: #374151;

    padding: 2px 6px;

    border-radius: 4px;

    font-size: 13px;
}

.filter-help table {

    width: 100%;

    border-collapse: collapse;
}

.filter-help td {

    padding: 6px 12px;

    border-bottom: 1px solid var(--border);

    vertical-align: top;
}

.filter-help td:first-child {

    white-space: nowrap;

    width: 1%;
}

@media (max-width: 750px) {
    .filter-help table,
    .filter-help tbody,
    .filter-help tr,
    .filter-help td {
        display: block;
        width: 100%;
    }

    .filter-help td {
        padding: 8px 0 10px;
        border-bottom: 1px solid var(--border);
    }

    .filter-help td:first-child {
        white-space: normal;
        width: 100%;
        padding-bottom: 2px;
        font-weight: 700;
    }
}

.hidden {

    display: none;
}

/*************************************************/
/* Filter Summary                                */
/*************************************************/

#filterSummary {

    color: var(--muted);

    font-size: 14px;

    margin-bottom: 12px;
}

.page-disclaimer {

    color: var(--muted);

    font-size: 12px;

    line-height: 1.5;

    text-align: center;

    margin: 28px auto 20px;

    max-width: 960px;

    padding: 0 16px;
}

/*************************************************/
/* Pagination                                    */
/*************************************************/

.pagination {

    display: flex;

    justify-content: center;

    align-items: center;

    gap: 18px;

    margin: 30px 0;
}

button {

    border: none;

    border-radius: 8px;

    background: #2563eb;

    color: white;

    padding: 10px 16px;

    font-size: 14px;

    cursor: pointer;
}

button:hover:not(:disabled) {

    background: #3b82f6;
}

button:disabled {

    opacity: .35;

    cursor: not-allowed;
}

#pageInfo {

    color: var(--muted);

    font-size: 15px;
}

/*************************************************/
/* ELO                                           */
/*************************************************/

.elo {

    text-align: center;

    padding: 12px 16px;

    background: #111827;

    border-radius: 12px;

    min-width: 80px;
}

.elo-label {

    font-size: 11px;

    text-transform: uppercase;

    letter-spacing: .12em;

    color: var(--muted);

    margin-bottom: 4px;
}

.elo-value {

    font-size: 22px;

    font-weight: 800;

    color: var(--accent);
}

.elo-record {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #e2e8f0;
    font-family: Inter, system-ui, sans-serif;
}

/*************************************************/
/* Mobile                                        */
/*************************************************/

@media (max-width: 750px) {

    header {

        flex-direction: column;

        gap: 12px;
    }

    header > div:first-child {
        width: 100%;
        text-align: center;
    }

    header h1 {
        text-align: center;
    }

    .subtitle {
        text-align: center;
    }

    .card {

        grid-template-columns: 1fr;

        text-align: center;
    }

    .rank {

        font-size: 20px;
    }

    .card img {

        width: 150px;

        margin: auto;
    }

    .colors {

        display: inline-flex;
        justify-content: flex-start;
        align-items: center;
        gap: 2px;
        flex-wrap: nowrap;
        margin: 10px 0 0;
    }

    .colors img {
        width: 22px;
        height: 22px;
    }

    .vs-header h1 {
        font-size: 28px;
    }

    .vs-stats {
        padding: 10px 14px;
        gap: 12px;
    }

    .vs-stats .stat-value {
        font-size: 24px;
    }

    .leaderboard-link {
        padding: 8px 12px;
        font-size: 12px;
    }

    .vs-card {
        max-width: 320px;
        width: 100%;
        padding: 14px;
    }

    .vs-card img {
        max-width: 220px;
    }

    .vs-card .card-name {
        font-size: 15px;
    }

    .vs-card .card-type {
        font-size: 12px;
    }

    .vs-card .elo-display {
        padding: 5px 12px;
        font-size: 13px;
    }

    .vs-card .elo-change {
        font-size: 12px;
    }

    .vs-card .click-hint {
        display: none;
    }
}