/* ---------- design tokens (ported from the HTML prototype) ---------- */
:root {
    --ink: #171a26;
    --ink2: #1f2333;
    --ink3: #2a2d3d;
    --paper: #fdf6e3;
    --paper-dim: #eadfc0;
    --smash: #ef4136;
    --fame: #29b6c9;
    --energy: #a8e050;
    --keep: #29b6c9;
    --discard: #ef4136;
    --purple: #c94dd6;
    --outline: #12141c;
    --radius: 10px;
    --max-width: 1180px;
    --display: "Bangers", Impact, cursive;
    --condensed: "Barlow Condensed", "Segoe UI", sans-serif;
    --body-font: "Work Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    background: var(--ink);
    color: var(--paper);
    font-family: var(--body-font);
    line-height: 1.55;
}

a {
    color: inherit;
    text-decoration: none;
}

h1 {
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(22px, 5.5vw, 38px);
    line-height: 1.02;
    letter-spacing: .01em;
    margin: 0 0 12px;
    -webkit-text-stroke: 1.5px var(--outline);
    text-shadow: 2px 2px 0 var(--smash), 4px 4px 0 rgba(0, 0, 0, .35);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Halftone dot pattern behind the whole page. */
.halftone {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .09;
    background-image: radial-gradient(circle, #fff 1.2px, transparent 1.6px);
    background-size: 7px 7px;
    z-index: 0;
}

/* Game symbols inlined into card texts by CardTextRenderer. */
.icon-inline {
    height: 1.2em;
    width: 1.2em;
    vertical-align: -0.28em;
    object-fit: contain;
    display: inline-block;
    margin: 0 1px;
    border-radius: 4px;
}

/* KEEP/DISCARD keywords highlighted inside card texts. */
.kw {
    font-weight: 800;
}

.kw--keep {
    color: #0891a3;
}

/* ---------- layout ---------- */
.page {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: .7rem 1.25rem;
    background: var(--ink2);
    border-bottom: 3px solid var(--outline);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-wrap: wrap;
}

.header__brand {
    font-family: var(--display);
    font-size: 1.25rem;
    letter-spacing: .02em;
    color: var(--paper);
}

.header__nav {
    display: flex;
    gap: 1rem;
    margin-right: auto;
    font-family: var(--condensed);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
    color: var(--paper-dim);
}

.header__nav .active {
    color: var(--energy);
}

.content {
    flex: 1;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.75rem 1.25rem 3rem;
}

.footer {
    padding: 1rem 1.25rem 1.5rem;
    border-top: 2px dashed var(--paper-dim);
    color: var(--paper-dim);
    font-family: var(--condensed);
    font-size: 12.5px;
    letter-spacing: .03em;
    text-align: center;
}

/* ---------- controls ---------- */
select, input[type="search"] {
    background: var(--paper);
    color: var(--ink);
    border: 3px solid var(--outline);
    border-radius: 20px;
    padding: .5rem .9rem;
    font: inherit;
    font-weight: 500;
    outline: none;
}

input[type="search"]::placeholder {
    color: #8a8368;
}

select:focus-visible, input:focus-visible, a:focus-visible, button:focus-visible {
    outline: 2px solid var(--energy);
    outline-offset: 2px;
}

.button {
    display: inline-block;
    font-family: var(--display);
    letter-spacing: .03em;
    font-size: 18px;
    background: var(--energy);
    color: var(--outline);
    border: 3px solid var(--outline);
    border-radius: 20px;
    padding: .45rem 1.4rem;
}

.button:hover {
    background: var(--paper);
}

.toolbar {
    position: sticky;
    top: 3.4rem;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    background: var(--ink2);
    border: 2px solid var(--paper-dim);
    border-radius: var(--radius);
    padding: .8rem 1rem;
    margin-bottom: 1.5rem;
}

.search-box {
    position: relative;
    flex: 1 1 260px;
}

.search-box input {
    width: 100%;
    padding-right: 2.4rem;
}

.search-box__clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: var(--outline);
    color: var(--paper);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.chip {
    font-family: var(--display);
    letter-spacing: .03em;
    font-size: 15px;
    padding: .45rem 1rem;
    min-height: 40px;
    border-radius: 20px;
    border: 3px solid var(--outline);
    background: var(--ink3);
    color: var(--paper-dim);
    cursor: pointer;
    transition: .12s;
}

.chip:hover {
    color: var(--paper);
    background: #343850;
    transform: translateY(-1px);
}

.chip--active {
    background: var(--energy);
    color: var(--outline);
}

.toolbar__count {
    margin-left: auto;
    font-family: var(--condensed);
    font-size: 13px;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--paper-dim);
}

/* ---------- home ---------- */
.hero {
    position: relative;
    border: 4px solid var(--outline);
    border-radius: 12px;
    background: var(--ink2);
    padding: 1.5rem 1.25rem;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255, 255, 255, .5) 1.3px, transparent 1.6px);
    background-size: 9px 9px;
    opacity: .06;
}

.kicker {
    font-family: var(--condensed);
    font-weight: 700;
    letter-spacing: .2em;
    text-transform: uppercase;
    font-size: 12px;
    color: var(--energy);
    margin: 0 0 6px;
}

.hero__tagline {
    font-size: 13.5px;
    color: var(--paper-dim);
    max-width: 600px;
    line-height: 1.5;
    margin: 0;
    border-left: 3px solid var(--energy);
    padding: 8px 12px;
}

.stats {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    margin: 1rem 0 1.4rem;
}

.stat {
    font-family: var(--condensed);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    background: var(--paper);
    border: 2px solid var(--outline);
    border-radius: 20px;
    padding: 5px 12px;
}

.stat b {
    color: var(--smash);
    font-family: var(--display);
    font-size: 15px;
    margin-right: 3px;
}

/* ---------- badges ---------- */
.badges {
    display: flex;
    gap: .35rem;
    align-items: center;
    flex-wrap: wrap;
}

.badge {
    font-family: var(--display);
    font-size: 11px;
    letter-spacing: .02em;
    padding: 2px 9px;
    border-radius: 20px;
    border: 2px solid var(--outline);
    white-space: nowrap;
}

.badge--keep {
    background: var(--keep);
    color: #04262b;
}

.badge--discard {
    background: var(--discard);
    color: #3a0704;
}

.badge--promo {
    background: var(--purple);
    color: #2b0730;
}

.badge--buzz {
    background: #8fd13f;
    color: #12200a;
}

.badge--cost {
    background: var(--outline);
    color: var(--energy);
}

.buzz-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--energy);
    border: 1.5px solid var(--outline);
    margin-left: auto;
}

/* ---------- card grid ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.card-tile {
    display: block;
    background: var(--paper-dim);
    border: 3px solid var(--outline);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .12s;
}

.card-tile:hover {
    transform: translateY(-4px) rotate(-1deg);
}

.card-tile__image {
    width: 100%;
    display: block;
    aspect-ratio: 280 / 396;
    object-fit: cover;
    background: #000;
}

.card-tile__meta {
    padding: 8px 9px 10px;
}

.card-tile__name {
    font-family: var(--display);
    font-size: 16px;
    line-height: 1.05;
    letter-spacing: .01em;
    color: var(--ink);
    margin: 0 0 5px;
}

/* ---------- card details ---------- */
.back-link {
    display: inline-block;
    font-family: var(--condensed);
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--paper-dim);
    margin-bottom: 1.25rem;
}

.back-link:hover {
    color: var(--energy);
}

.card-details {
    display: grid;
    grid-template-columns: minmax(200px, 300px) 1fr;
    background: var(--paper);
    color: var(--ink);
    border: 5px solid var(--outline);
    border-radius: 14px;
    overflow: hidden;
}

.card-details__image img {
    width: 100%;
    display: block;
    border-right: 4px solid var(--outline);
}

.card-details__body {
    padding: 1.25rem 1.4rem;
    min-width: 0;
}

.card-details__name {
    font-size: 32px;
    margin: 0 0 10px;
    color: var(--smash);
    text-shadow: none;
}

.card-details__body .badges {
    margin-bottom: 14px;
}

.card-details__effect {
    position: relative;
    font-size: 17px;
    line-height: 1.55;
    font-weight: 500;
    background: #fff;
    border: 3px solid var(--outline);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 12px;
}

.card-details__effect::before {
    content: "";
    position: absolute;
    left: -11px;
    top: 16px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-left: 3px solid var(--outline);
    border-bottom: 3px solid var(--outline);
    transform: rotate(45deg);
}

.card-details__note {
    font-size: 14px;
    line-height: 1.5;
    color: #2b2510;
    background: #fff3d6;
    border: 2px solid #d9a441;
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 10px;
}

.card-details__note b {
    color: #8a5b06;
    font-family: var(--condensed);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.card-details__comment {
    font-size: 14.5px;
    line-height: 1.5;
    color: #2c3018;
    background: #eef7d8;
    border: 2px dashed #6f9c2e;
    border-radius: var(--radius);
    padding: 10px 12px;
}

.card-details__comment b {
    color: #3d6e0f;
    font-family: var(--condensed);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
}

.tag {
    font-family: var(--condensed);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: var(--paper-dim);
    border: 2px solid var(--outline);
    border-radius: 999px;
    padding: 1px 10px;
}

.card-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 1.25rem;
}

.nav-btn {
    font-family: var(--display);
    letter-spacing: .03em;
    font-size: 15px;
    padding: 8px 18px;
    border-radius: 20px;
    border: 3px solid var(--outline);
    background: var(--paper-dim);
    color: var(--ink);
}

.nav-btn:hover {
    background: var(--energy);
}

.nav-btn--disabled {
    opacity: .3;
}

.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--paper-dim);
    font-family: var(--display);
    font-size: 22px;
}

@media (max-width: 700px) {
    .card-details {
        grid-template-columns: 1fr;
    }

    .card-details__image img {
        border-right: none;
        border-bottom: 4px solid var(--outline);
        max-height: 40vh;
        object-fit: cover;
    }
}

@media (max-width: 640px) {
    .content {
        padding: 1rem .6rem 2.5rem;
    }

    .toolbar {
        top: 3rem;
        flex-direction: column;
        align-items: stretch;
        padding: .6rem;
    }

    .chips-row {
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
    }

    .chips-row::-webkit-scrollbar {
        display: none;
    }

    .chip {
        font-size: 12.5px;
        padding: 7px 13px;
        min-height: 34px;
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .toolbar__count {
        margin-left: 0;
    }

    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }

    .card-tile {
        border-width: 2px;
        border-radius: 8px;
    }

    .card-tile:hover {
        transform: none;
    }

    .card-tile__meta {
        padding: 6px 7px 8px;
    }

    .card-tile__name {
        font-size: 12px;
    }

    .badge {
        font-size: 9px;
        padding: 2px 6px;
        border-width: 1.5px;
    }

    .card-details__name {
        font-size: 24px;
    }

    .card-details__effect {
        font-size: 15.5px;
        padding: 11px 13px;
    }

    .card-details__effect::before {
        display: none;
    }

    .nav-btn {
        flex: 1;
        text-align: center;
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 6px;
    }
}

/* ---------- blazor infrastructure ---------- */
.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--ink3);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--energy);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
    color: var(--paper-dim);
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

#blazor-error-ui {
    background: var(--smash);
    color: #fff;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: var(--smash);
    color: #fff;
    padding: 1rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}
