/* PokéCollector: plain CSS, colours inspired by the classic red / yellow / blue trio */
:root {
    --red: #e3350d;
    --red-dark: #b8290a;
    --yellow: #ffcb05;
    --blue: #2a75bb;
    --navy: #1d2c5e;
    --link: var(--blue);

    --bg: #f4f6fb;
    --surface: #ffffff;
    --text: #1b2236;
    --muted: #5d6680;
    --border: #dfe3ee;
    --danger-bg: #fdecea;
    --danger-text: #a3200a;

    --radius: 16px;
    --shadow: 0 1px 2px rgb(16 24 40 / .06), 0 8px 24px rgb(16 24 40 / .08);
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1424;
        --surface: #182036;
        --text: #e8ecf6;
        --muted: #9aa3bd;
        --border: #2a3452;
        --danger-bg: #3a1a14;
        --danger-text: #ffb4a3;
        --link: #7cb8f0;
        --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .35);
    }
}

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

body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    color: var(--text);
    background:
        radial-gradient(circle at 100% 0, rgb(255 203 5 / .18), transparent 40%),
        radial-gradient(circle at 0 100%, rgb(42 117 187 / .15), transparent 45%),
        var(--bg);
    background-attachment: fixed;
}

a { color: var(--link); }
a:hover { color: var(--red); }

:focus-visible {
    outline: 3px solid var(--yellow);
    outline-offset: 2px;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--red);
    border-bottom: 4px solid var(--navy);
    color: #fff;
}

.site-header__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: .01em;
}
.brand:hover { color: var(--yellow); }

.site-header__user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .95rem;
}

/* Two-tone ball logo drawn in CSS */
.ball {
    --size: 28px;
    display: block;
    width: var(--size);
    height: var(--size);
    flex: none;
    border-radius: 50%;
    border: calc(var(--size) / 12) solid var(--navy);
    background: linear-gradient(to bottom, var(--red) 0 46%, var(--navy) 46% 54%, #fff 54% 100%);
    position: relative;
}
.ball::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 36%;
    height: 36%;
    translate: -50% -50%;
    border-radius: 50%;
    background: #fff;
    border: calc(var(--size) / 14) solid var(--navy);
}
.site-header .ball { background: linear-gradient(to bottom, #fff 0 46%, var(--navy) 46% 54%, #fff 54% 100%); }
.ball--lg { --size: 64px; }

/* ---------- Layout ---------- */
main {
    max-width: 1100px;
    margin: 0 auto;
    /* room below the content so the fixed "Add cards" button never covers it */
    padding: 2rem 1rem calc(7rem + env(safe-area-inset-bottom));
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; }

.muted { color: var(--muted); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

/* ---------- Auth pages ---------- */
.auth {
    max-width: 420px;
    margin: 4vh auto 0;
}
.auth__head {
    text-align: center;
    margin-bottom: 1.5rem;
}
.auth__head .ball { margin: 0 auto 1rem; }
.auth__switch {
    text-align: center;
    margin-top: 1.25rem;
    color: var(--muted);
}

/* ---------- Forms ---------- */
form > div,
.field { margin-bottom: 1rem; }

label {
    display: block;
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: .35rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
select {
    width: 100%;
    padding: .7rem .85rem;
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    transition: border-color .15s, box-shadow .15s;
}
input:focus,
select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgb(42 117 187 / .2);
}

/* Symfony form errors */
form ul {
    list-style: none;
    margin: .35rem 0 0;
    padding: 0;
    color: var(--danger-text);
    font-size: .875rem;
}

.btn,
button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    padding: .8rem 1.2rem;
    font: inherit;
    font-weight: 700;
    color: var(--navy);
    background: var(--yellow);
    border: 0;
    border-radius: 999px;
    box-shadow: inset 0 -3px 0 rgb(0 0 0 / .15);
    cursor: pointer;
    text-decoration: none;
    transition: transform .1s, filter .15s;
}
.btn:hover,
button[type="submit"]:hover { filter: brightness(1.05); color: var(--navy); }
.btn:active,
button[type="submit"]:active { transform: translateY(1px); }

.btn--ghost {
    width: auto;
    padding: .4rem .9rem;
    color: #fff;
    background: rgb(255 255 255 / .15);
    box-shadow: none;
    font-weight: 600;
}
.btn--ghost:hover { color: #fff; background: rgb(255 255 255 / .25); }

.alert {
    padding: .75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    background: var(--danger-bg);
    color: var(--danger-text);
}

/* ---------- Home ---------- */
.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat__label { color: var(--muted); font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat__value { font-size: 1.8rem; font-weight: 800; }
.stat__note { color: var(--muted); font-size: .75rem; }
.stat--accent { border-top: 4px solid var(--red); }
.stat--blue { border-top: 4px solid var(--blue); }
.stat--yellow { border-top: 4px solid var(--yellow); }

/* ---------- Floating "Add cards" button ---------- */
/* phone: wide thumb-reach bar at the bottom centre; desktop: pill in the bottom-right corner */
.fab {
    position: fixed;
    z-index: 20;
    left: 50%;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    translate: -50% 0;
    width: min(calc(100% - 2rem), 420px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 1rem 1.6rem;
    font: inherit;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--navy);
    background: var(--yellow);
    border: 3px solid var(--navy);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgb(0 0 0 / .3), inset 0 -3px 0 rgb(0 0 0 / .15);
    cursor: pointer;
    transition: transform .15s, filter .15s;
}
.fab:hover { filter: brightness(1.05); }
.fab:active { transform: scale(.97); }

@media (min-width: 900px) {
    .fab {
        left: auto;
        right: 2rem;
        bottom: 2rem;
        translate: none;
        width: auto;
    }
}

/* ---------- Quick add (bottom sheet) ---------- */
.sheet {
    width: min(100%, 860px);
    max-width: none;
    margin: auto auto 0;
    padding: 1rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
    color: var(--text);
    background: var(--surface);
    border: 0;
    border-top: 4px solid var(--red);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -12px 40px rgb(0 0 0 / .3);
}
.sheet[open] { animation: sheet-up .25s ease-out; }
.sheet::backdrop {
    background: rgb(15 20 36 / .45);
    backdrop-filter: blur(2px);
}

.sheet__title { margin: .35rem 3rem 1rem 0; font-size: 1.2rem; }
.sheet__close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1rem;
    color: var(--muted);
    background: var(--bg);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}
.sheet__close:hover { color: var(--text); }

.quick-add {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1.4fr) auto;
    gap: .75rem;
    align-items: start;
}
.quick-add > div { margin: 0; }
.quick-add > ul { grid-column: 1 / -1; margin: 0; }
.quick-add button[type="submit"] {
    width: auto;
    margin-top: 1.7rem; /* line up with the inputs below their labels */
    padding-inline: 1.6rem;
}

/* Card panel in the sheet: the tapped or just-added card with −/+ per variant */
.card-panel {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .75rem 1rem;
    align-items: center;
    padding: .85rem;
    margin-bottom: 1rem;
    border-radius: 14px;
    background: var(--bg);
}
.card-panel.is-added {
    background: rgb(42 117 187 / .12);
    box-shadow: inset 4px 0 0 var(--blue);
    animation: pop .3s ease-out;
}
.card-panel img { border-radius: 6px; box-shadow: 0 2px 8px rgb(0 0 0 / .3); }
.card-panel__body { min-width: 0; }
.card-panel .muted { font-size: .875rem; }

.steppers {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .5rem;
}
.stepper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 2rem minmax(0, 1fr);
    gap: .25rem;
    align-items: center;
    margin: 0;
    padding: .35rem;
    border: 2px solid var(--border);
    border-radius: 12px;
}
.stepper.is-owned { border-color: var(--yellow); }
.stepper__label {
    grid-column: 1 / -1;
    margin-bottom: .2rem;
    font-size: .75rem;
    font-weight: 700;
    color: var(--muted);
    text-align: center;
}
.stepper output { font-size: 1.15rem; font-weight: 800; text-align: center; }
.stepper button {
    width: 100%;
    height: 2.75rem; /* thumb-sized touch target */
    padding: 0;
    margin: 0;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--navy);
    background: var(--yellow);
    border: 0;
    border-radius: 10px;
    box-shadow: none;
    cursor: pointer;
}
.stepper button[value="-1"] { color: var(--text); background: var(--surface); border: 2px solid var(--border); }
.stepper button:disabled { opacity: .35; cursor: default; }

@keyframes sheet-up {
    from { transform: translateY(100%); }
}
@keyframes pop {
    from { opacity: 0; transform: scale(.96); }
}

@media (max-width: 640px) {
    .quick-add { grid-template-columns: 1fr 1fr; }
    .quick-add > div:first-of-type { grid-column: 1 / -1; }
    .quick-add button[type="submit"] { grid-column: 1 / -1; width: 100%; margin-top: 0; }
}

/* ---------- Latest sets ---------- */
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 2rem 0 1rem;
}
.section-head h2 { margin: 0; }

.sets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.set-card {
    position: relative;
    color: inherit;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
    animation: set-in .5s ease both;
    animation-delay: calc(var(--i, 0) * 70ms);
}
.set-card:hover {
    transform: translateY(-4px) rotate(-.5deg);
    box-shadow: 0 12px 32px rgb(16 24 40 / .18);
}

.set-card__logo {
    display: grid;
    place-items: center;
    height: 110px;
    padding: 1rem;
    background:
        radial-gradient(circle at 50% 120%, rgb(255 203 5 / .35), transparent 70%),
        linear-gradient(135deg, var(--navy), #2b3f80);
}
.set-card__logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgb(0 0 0 / .35));
}
.set-card__logo .ball { --size: 48px; }

.set-card__body { padding: .9rem 1rem 1rem; }
.set-card__name { font-weight: 700; line-height: 1.3; }
.set-card__meta { color: var(--muted); font-size: .875rem; }

.badge {
    position: absolute;
    top: .6rem;
    right: .6rem;
    padding: .15rem .55rem;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .05em;
    color: var(--navy);
    background: var(--yellow);
    border-radius: 999px;
    box-shadow: 0 2px 6px rgb(0 0 0 / .25);
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes set-in {
    from { opacity: 0; transform: translateY(12px); }
}
@keyframes badge-pulse {
    50% { transform: scale(1.08); }
}

/* ---------- Collectors ---------- */
.collectors {
    display: grid;
    gap: .75rem;
    margin: 1.5rem 0 0;
    padding: 0;
    list-style: none;
}
.collector {
    display: grid;
    grid-template-columns: 2.5rem 1fr auto;
    grid-template-areas: "rank name value" "rank meta value";
    align-items: center;
    column-gap: 1rem;
    padding: 1rem 1.25rem;
    color: inherit;
    text-decoration: none;
    transition: transform .15s ease;
}
.collector:hover { transform: translateX(4px); color: inherit; }
.collector.is-me { border-color: var(--yellow); }
.collector__rank {
    grid-area: rank;
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    font-weight: 800;
    color: #fff;
    background: var(--red);
    border-radius: 50%;
}
.collector__name { grid-area: name; font-weight: 800; font-size: 1.1rem; }
.collector__meta { grid-area: meta; color: var(--muted); font-size: .875rem; }
.collector__value { grid-area: value; font-size: 1.2rem; }

.site-header__user .btn--ghost[aria-current="page"] { color: var(--navy); background: var(--yellow); }

/* ---------- Friends ---------- */
/* .btn.btn--x: must beat the global button[type="submit"] rule */
.btn.btn--small { width: auto; padding: .5rem 1rem; font-size: .9rem; }
.btn.btn--quiet { color: var(--text); background: var(--surface); border: 2px solid var(--border); box-shadow: none; }
.btn.btn--quiet:hover { color: var(--text); }
.inline-form { display: inline; margin: 0; }

.search {
    display: flex;
    gap: .5rem;
    margin: 1.25rem 0 1rem;
}
.search input { flex: 1; }

.people { margin-bottom: 1rem; }
.people h2 { font-size: 1.1rem; margin-bottom: .5rem; }
.people--incoming { border-color: var(--yellow); }
.person {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 0;
}
.person + .person { border-top: 1px solid var(--border); }
.person__name { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }

.nav-badge {
    display: inline-grid;
    place-items: center;
    min-width: 1.3rem;
    height: 1.3rem;
    margin-left: .25rem;
    padding: 0 .3rem;
    font-size: .75rem;
    font-weight: 800;
    color: var(--navy);
    background: var(--yellow);
    border-radius: 999px;
}
.flash {
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 10px;
    background: rgb(42 117 187 / .15);
    border-left: 4px solid var(--blue);
}

/* ---------- Progress ---------- */
.progress {
    height: 6px;
    margin-top: .5rem;
    overflow: hidden;
    background: var(--border);
    border-radius: 999px;
}
.progress > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--red), var(--yellow));
    border-radius: inherit;
    transition: width .4s ease;
}
.progress--lg { height: 10px; }

/* ---------- Set page ---------- */
.back {
    display: inline-block;
    margin-bottom: 1rem;
    font-weight: 600;
    text-decoration: none;
}

.set-head {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}
.set-head__logo {
    width: 180px;
    max-height: 90px;
    object-fit: contain;
    flex: none;
}
.set-head__info { flex: 1; min-width: 0; }
.set-head h1 { margin-bottom: .25rem; }
.set-head p { margin: 0 0 .75rem; }
.code {
    padding: .1rem .5rem;
    font-weight: 800;
    letter-spacing: .05em;
    color: var(--navy);
    background: var(--yellow);
    border-radius: 6px;
}
.owner-note { margin: 0 0 .25rem; font-weight: 700; color: var(--red); }
.set-progress__text { display: flex; align-items: baseline; gap: .4rem; font-size: 1.05rem; }
.set-progress__value { margin-left: auto; font-size: 1.3rem; font-weight: 800; }

/* All / Owned / Missing: radio chips, filtering is pure CSS via :has() */
.filter {
    display: flex;
    gap: .5rem;
    margin: 0 0 1rem;
    padding: 0;
    border: 0;
}
.filter input { position: absolute; opacity: 0; pointer-events: none; }
.filter label {
    margin: 0;
    padding: .45rem 1rem;
    font-weight: 700;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
}
.filter input:checked + label { color: var(--navy); background: var(--yellow); border-color: var(--yellow); }
.filter input:focus-visible + label { outline: 3px solid var(--blue); outline-offset: 2px; }
.set-page:has(#filter-owned:checked) .album-card:not(.is-owned),
.set-page:has(#filter-missing:checked) .album-card.is-owned { display: none; }

.album {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .9rem;
}

.album-card {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    aspect-ratio: 245 / 337;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 0;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, filter .2s, opacity .2s;
}
.album-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.album-card:not(.is-owned) { filter: grayscale(1); opacity: .35; }
.album-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); filter: none; opacity: 1; }
.album-card.is-owned { box-shadow: 0 0 0 3px var(--yellow), var(--shadow); }

.album-card__noimg {
    display: grid;
    place-items: center;
    height: 100%;
    padding: .5rem;
    font-size: .85rem;
    font-weight: 700;
    text-align: center;
}
.album-card__no {
    position: absolute;
    top: .35rem;
    left: .35rem;
    padding: .05rem .4rem;
    font-size: .75rem;
    font-weight: 700;
    color: #fff;
    background: rgb(0 0 0 / .6);
    border-radius: 6px;
}
.album-card__price {
    position: absolute;
    top: .35rem;
    right: .35rem;
    padding: .05rem .4rem;
    font-size: .75rem;
    font-weight: 800;
    color: #fff;
    background: rgb(29 44 94 / .85);
    border-radius: 6px;
}
.album-card__qty {
    position: absolute;
    right: .35rem;
    bottom: .35rem;
    left: .35rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .25rem;
}
.album-card__qty span {
    padding: .1rem .45rem;
    font-size: .75rem;
    font-weight: 800;
    color: var(--navy);
    background: var(--yellow);
    border-radius: 999px;
    box-shadow: 0 1px 4px rgb(0 0 0 / .3);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

@media (max-width: 560px) {
    .site-header__name { display: none; }
    .site-header__user { gap: .5rem; }
    /* compact stat row so "My sets" is visible without scrolling */
    /* the value tile gets more room: "1.234,56 €" must fit on one line */
    .stats { grid-template-columns: minmax(0, .8fr) minmax(0, .7fr) minmax(0, 1.5fr); gap: .5rem; }
    .stat__value { white-space: nowrap; }
    .stat { padding: .75rem; }
    .stat__label { font-size: .65rem; }
    .stat__value { font-size: 1.25rem; }
    .sets { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .set-head { flex-direction: column; align-items: stretch; text-align: center; gap: .75rem; }
    .set-head__logo { width: 100%; max-height: 70px; }
    .album { grid-template-columns: repeat(3, 1fr); gap: .5rem; }
    .album-card__qty span, .album-card__price { font-size: .65rem; padding: .05rem .35rem; }
    .set-progress__text { justify-content: center; flex-wrap: wrap; }
    .set-progress__value { margin-left: 0; width: 100%; }
}

/* the ball alone is the home link on narrow phones, so both buttons fit */
@media (max-width: 420px) {
    .brand__name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
