/* ===========================================================================
   Design tokens
   ======================================================================== */
:root {
    --bg-0: #0b0e1f;
    --bg-1: #141834;

    --surface: rgba(255, 255, 255, 0.05);
    --surface-2: rgba(255, 255, 255, 0.08);
    --well: rgba(0, 0, 0, 0.28);

    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.20);

    --text: #eef1ff;
    --muted: #98a0c9;

    --accent: #e63946;      /* Pokéball red */
    --accent-2: #ff6b6b;
    --gold: #ffcb47;        /* money / selection */
    --gold-soft: rgba(255, 203, 71, 0.14);

    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --radius: 16px;
    --radius-sm: 11px;
}

/* ===========================================================================
   Base
   ======================================================================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 24px clamp(16px, 4vw, 48px) 40px;

    font-family: "Fredoka", system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--text);

    background:
        radial-gradient(1200px 600px at 85% -10%, rgba(230, 57, 70, 0.16), transparent 60%),
        radial-gradient(1000px 700px at 0% 110%, rgba(88, 101, 242, 0.16), transparent 55%),
        linear-gradient(160deg, var(--bg-1), var(--bg-0));
    background-attachment: fixed;
}

img {
    /* Sprites are low-res pixel art — keep them crisp when scaled up. */
    image-rendering: pixelated;
}

/* ===========================================================================
   Header
   ======================================================================== */
.app-header {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 1240px;
    margin: 0 auto 22px;
}

.app-title {
    margin: 0;
    font-size: clamp(1.6rem, 3.2vw, 2.4rem);
    font-weight: 700;
    letter-spacing: 0.3px;
    background: linear-gradient(180deg, #fff, #b9c0ec);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* CSS Pokéball logo */
.logo {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(#ef4356 0 50%, #f4f4f8 50% 100%);
    border: 2px solid var(--bg-0);
    box-shadow: var(--shadow);
    flex: none;
}
.logo::before {
    content: "";
    position: absolute;
    left: -2px;
    right: -2px;
    top: 50%;
    height: 3px;
    transform: translateY(-50%);
    background: var(--bg-0);
}
.logo::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 13px;
    height: 13px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: #f4f4f8;
    border: 3px solid var(--bg-0);
}

/* ===========================================================================
   Layout
   ======================================================================== */
.layout {
    max-width: 1240px;
    margin: 0 auto;
}

.board-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 16px;
    align-items: start;
}

.board-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

#trainers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
    align-content: start;
}

#current-view {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow: hidden auto;
}

/* ===========================================================================
   Trainer cards
   ======================================================================== */
.trainer-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);

    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease,
        background 0.15s ease, box-shadow 0.15s ease;
}

.trainer-view:hover {
    transform: translateY(-2px);
    background: var(--surface-2);
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
}

.trainer-view:focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: 2px;
}

.trainer-view.selected-trainer {
    background: linear-gradient(var(--gold-soft), var(--gold-soft)), var(--surface-2);
    border-color: var(--gold);
    box-shadow: 0 0 0 1px var(--gold), 0 10px 26px rgba(255, 203, 71, 0.18);
}

.text-view {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.text-view > p {
    margin: 0;
    font-weight: 600;
}

.text-view > .money {
    color: var(--gold);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.team-view {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.team-view > img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    padding: 3px;

    background: var(--well);
    border: 1px solid var(--border);
    border-radius: 10px;
}

/* ===========================================================================
   Auction stage (current Pokémon)
   ======================================================================== */
#current-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px;

    background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

/* Spotlight behind the sprite */
#current-view::before {
    content: "";
    position: absolute;
    top: -10%;
    left: 50%;
    width: 420px;
    height: 420px;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(255, 203, 71, 0.18), transparent 62%);
    pointer-events: none;
}

#current-view > h1 {
    position: relative;
    margin: 0;
    font-size: clamp(1.6rem, 2.4vw, 2.1rem);
    font-weight: 700;
    text-align: center;
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

#current-view > img {
    position: relative;
    width: min(210px, 58%);
    aspect-ratio: 1;
    object-fit: contain;
    filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.55));
}

/* Fixed height so a longer/shorter description never nudges the sprite up or
   down (e.g. when cycling Eevee's forms). Sized to fit the longest note; short
   ones just centre in the reserved space. */
/* Natural block that grows with its text (no scrollbar). A small min-height
   keeps short notes from collapsing so the sprite doesn't jump much when cycling
   forms; long notes just extend a little downward. */
#cv-note {
    position: relative;
    margin: -6px 0 0;
    max-width: 90%;
    min-height: 2.7em;
    text-align: center;
    overflow-wrap: break-word;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.35;
}
#cv-note[hidden] { display: none; }

/* Evolution line under the current Pokemon — fixed row, no wrap/reflow */
.evo-line {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 4px 8px;

    width: min(340px, 90%);
    padding: 8px 12px;
    overflow-x: auto;
    background: var(--well);
    border: 1px solid var(--border);
    border-radius: 14px;
}
.evo-line[hidden] { display: none; }
.evo-stage { cursor: pointer; }

/* Fixed-height preview panel that shows the hovered stage's stats (defaults to
   the current stage) so hovering never shifts the layout. */
.evo-stats-preview {
    min-height: 172px;
    justify-content: center;
}
.evo-stats-preview[hidden] { display: none; }

.evo-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    border-radius: 10px;
    opacity: 0.75;
}
.evo-stage.current {
    background: rgba(255, 203, 71, 0.14);
    outline: 1px solid rgba(255, 203, 71, 0.4);
    opacity: 1;
}
.evo-stage > img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}
.evo-stage > span {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
}
.evo-stage.current > span { color: var(--text); }

.evo-arrow {
    color: var(--muted);
    font-size: 1.1rem;
    font-weight: 700;
}

/* Choosable final forms (Eevee → eeveelutions, Rotom → appliances, …) */
.forms-strip {
    position: relative;
    width: min(340px, 90%);
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;

    padding: 10px 12px 12px;
    background: var(--well);
    border: 1px solid var(--border);
    border-radius: 14px;
}
.forms-strip[hidden] { display: none; }

.forms-hint {
    flex-basis: 100%;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 2px;
}

.form-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    width: 74px;
    padding: 5px 2px;

    font: inherit;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.form-opt > img {
    width: 54px;
    height: 54px;
    object-fit: contain;
}
.form-opt > span {
    font-size: 0.68rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.1;
}
.form-opt:hover { color: var(--text); }
.form-opt.sel {
    color: var(--text);
    background: rgba(255, 203, 71, 0.14);
    border-color: rgba(255, 203, 71, 0.45);
}

/* Ability capsules (hidden ability emphasized with an "H" patch) */
.ability-strip {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 90%;
}
.ability-strip[hidden] { display: none; }

.ability-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: 999px; /* capsule */
}
.ability-chip.hidden {
    color: var(--gold);
    background: var(--gold-soft);
    border-color: rgba(255, 203, 71, 0.5);
}
/* "H" ability-patch marker on the hidden ability */
.ability-chip.hidden::before {
    content: "H";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 0.66rem;
    font-weight: 800;
    color: var(--bg-0);
    background: var(--gold);
    border-radius: 50%;
}

/* Stat spread bars under the current Pokemon */
.stat-block {
    position: relative;
    width: min(340px, 88%);
    display: flex;
    flex-direction: column;
    gap: 5px;

    padding: 10px 14px;
    background: var(--well);
    border: 1px solid var(--border);
    border-radius: 14px;
}
.stat-block[hidden] { display: none; }

.stat-head {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}

.stat-row {
    display: grid;
    grid-template-columns: 34px 1fr 34px;
    align-items: center;
    gap: 8px;
}

.stat-key {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--muted);
    text-transform: uppercase;
}

.stat-track {
    height: 9px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.stat-fill {
    display: block;
    height: 100%;
    border-radius: 6px;
    transition: width 0.35s ease;
}

.stat-val {
    text-align: right;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* Highest bid + upcoming queue, side by side under the bid bar (left column) */
#info-panel {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

#bets-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;

    min-width: 172px;
    padding: 10px 18px;
    background: var(--well);
    border: 1px solid var(--border);
    border-radius: 14px;
}
.bets-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}
#bets-view #hi-name {
    font-weight: 600;
    color: var(--text);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#bets-view #hi-amount {
    color: var(--gold);
    font-size: 1.6rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

#upcoming-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.section-label {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

#upcoming-pokemon {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    flex: 1;
    padding: 8px;

    background: var(--well);
    border: 1px solid var(--border);
    border-radius: 14px;
}

#upcoming-pokemon > img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 9px;
}

/* ===========================================================================
   Control panel
   ======================================================================== */
#control-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;

    margin-top: 14px;
    padding: 14px 16px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

#control-panel > div {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

#text-input {
    width: 160px;
    padding: 10px 14px;

    font: inherit;
    color: var(--text);
    background: var(--well);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

#text-input::placeholder {
    color: var(--muted);
}

#text-input:focus {
    outline: none;
    border-color: var(--accent-2);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.22);
}

#text-input:disabled {
    opacity: 0.5;
}

input[type="button"] {
    padding: 10px 20px;
    font: inherit;
    font-weight: 700;
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.1s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

#button-input {
    background: linear-gradient(180deg, var(--accent-2), var(--accent));
    box-shadow: 0 6px 16px rgba(230, 57, 70, 0.35);
}

#button-input:hover {
    filter: brightness(1.07);
}

#button-input:active {
    transform: translateY(1px);
}

#end-round-input {
    background: linear-gradient(180deg, #3a4270, #2a3160);
    border: 1px solid var(--border-strong);
}

#end-round-input:hover {
    filter: brightness(1.1);
}

input[type="button"]:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: none;
    box-shadow: none;
}

#status {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
}

#status.is-error {
    color: var(--accent-2);
}

/* ===========================================================================
   Responsive
   ======================================================================== */
@media (max-width: 820px) {
    .board-grid {
        grid-template-columns: 1fr;
    }

    #stage-root {
        order: -1;
    }

    #current-view {
        position: static;
        max-height: none;
        overflow: visible;
    }

    #control-panel,
    #bid-bar {
        justify-content: center;
    }
}

/* ===========================================================================
   Multiplayer additions
   ======================================================================== */

/* Header extras */
.app-header {
    justify-content: flex-start;
    flex-wrap: wrap;
}
.header-spacer { flex: 1; }

.badge {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
}
.badge.host { color: var(--gold); border-color: rgba(255, 203, 71, 0.4); background: var(--gold-soft); }
.badge.you  { color: var(--accent-2); border-color: rgba(255, 107, 107, 0.4); }

.conn-dot {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    color: var(--muted);
}
.conn-dot::before {
    content: "";
    width: 9px; height: 9px;
    border-radius: 50%;
    background: #ef4356;
    box-shadow: 0 0 8px rgba(239, 67, 86, 0.7);
}
.conn-dot.online::before { background: #37d67a; box-shadow: 0 0 8px rgba(55, 214, 122, 0.7); }

/* Trainer panel status (connection + you + winning) */
.trainer-view.empty { opacity: 0.45; }
.trainer-view.offline { opacity: 0.6; }
.trainer-view.winning {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px var(--gold), 0 10px 26px rgba(255, 203, 71, 0.2);
}
.trainer-view.me { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.trainer-view { cursor: default; }
.trainer-view:hover { transform: none; background: var(--surface); border-color: var(--border); box-shadow: none; }
.trainer-view.winning:hover { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 10px 26px rgba(255, 203, 71, 0.2); }

.name-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.name-line .seat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-line .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #37d67a; flex: none;
}
.name-line .dot.off { background: #6b7194; }
.tag {
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.05em;
    padding: 1px 6px; border-radius: 6px; text-transform: uppercase;
}
.tag.host { color: var(--gold); background: var(--gold-soft); }
.tag.you  { color: var(--accent-2); background: rgba(255, 107, 107, 0.14); }

/* Countdown timer — lives top-right in the page header */
#timer-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 16px;
    background: var(--well);
    border: 1px solid var(--border);
    border-radius: 999px;
}
#timer-wrap::before {
    content: "⏱";
    font-size: 1.1rem;
    opacity: 0.75;
}
#timer {
    font-size: 1.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    min-width: 2.5ch;
    text-align: center;
    line-height: 1;
}
#timer.low { color: var(--accent-2); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* Stage banner (lobby / paused / sold / complete) */
.stage-banner {
    position: relative;
    width: 100%;
    text-align: center;
    padding: 10px 12px;
    border-radius: 12px;
    font-weight: 600;
    background: var(--well);
    border: 1px solid var(--border);
}
.stage-banner.sold { color: var(--gold); border-color: rgba(255, 203, 71, 0.4); }
.stage-banner.pass { color: var(--muted); }

/* Host control bar + bid bar */
#host-controls, #bid-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
#host-controls .spacer { flex: 1; }

/* Manual assign (host escape hatch — deliberately low-key) */
#manual-award {
    font-size: 0.85rem;
    color: var(--muted);
}
#manual-award > summary {
    cursor: pointer;
    padding: 4px 2px;
    list-style: none;
    user-select: none;
}
#manual-award > summary::-webkit-details-marker { display: none; }
#manual-award > summary::before { content: "⚙ "; opacity: 0.7; }
#manual-award > summary:hover { color: var(--text); }
.manual-award-body {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.manual-award-body .input { width: auto; }
#host-controls .label { color: var(--muted); font-size: 0.85rem; font-weight: 600; margin-right: 4px; }

button.ctrl {
    padding: 9px 16px;
    font: inherit; font-weight: 700; color: #fff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, #3a4270, #2a3160);
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.1s ease;
}
button.ctrl:hover { filter: brightness(1.12); }
button.ctrl:active { transform: translateY(1px); }
button.ctrl.primary { background: linear-gradient(180deg, #3ed48c, #22a866); border: none; }
button.ctrl.danger  { background: linear-gradient(180deg, var(--accent-2), var(--accent)); border: none; }
button.ctrl:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }

#bid-bar .your-money { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
#bid-bar .grow { flex: 1; }

/* Forms (setup + join) */
.card {
    max-width: 560px;
    margin: 0 auto;
    padding: 26px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 6px; }
.card .hint { color: var(--muted); font-size: 0.9rem; margin: 0 0 18px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .sub { color: var(--muted); font-weight: 400; font-size: 0.82rem; }
.field label.check-field { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 0; cursor: pointer; }
.field label.check-field input { margin-top: 3px; flex: none; width: 16px; height: 16px; accent-color: var(--accent-2); cursor: pointer; }
.field label.check-field .sub { display: block; margin-top: 2px; }

.input, textarea.input {
    width: 100%;
    padding: 11px 14px;
    font: inherit;
    color: var(--text);
    background: var(--well);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.input:focus, textarea.input:focus {
    outline: none;
    border-color: var(--accent-2);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.22);
}
textarea.input { min-height: 150px; resize: vertical; font-family: ui-monospace, "Cascadia Code", monospace; font-size: 0.85rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.btn {
    display: inline-block;
    padding: 12px 22px;
    font: inherit; font-weight: 700; color: #fff;
    border: none; border-radius: var(--radius-sm);
    background: linear-gradient(180deg, var(--accent-2), var(--accent));
    box-shadow: 0 6px 16px rgba(230, 57, 70, 0.35);
    cursor: pointer; text-decoration: none;
    transition: filter 0.15s ease, transform 0.1s ease;
}
.btn.secondary { background: linear-gradient(180deg, #3a4270, #2a3160); box-shadow: none; border: 1px solid var(--border-strong); }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.block { display: block; width: 100%; text-align: center; }

.form-msg { margin-top: 14px; font-weight: 600; min-height: 1.2em; }
.form-msg.error { color: var(--accent-2); }
.form-msg.ok { color: #3ed48c; }
.form-msg ul { margin: 6px 0 0; padding-left: 20px; font-weight: 400; }

.landing-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }

/* File input */
input[type="file"].input { padding: 9px; cursor: pointer; }
input[type="file"].input::file-selector-button {
    font: inherit; font-weight: 600; margin-right: 12px;
    padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border-strong);
    background: var(--surface-2); color: var(--text); cursor: pointer;
}

/* ===========================================================================
   Flashy overlays (bid paddle + win takeover) and owned-Pokémon hover card
   ======================================================================== */
#fx-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 60;
}

/* --- Per-bid numbered paddle: pops up over the bidding player's card --- */
.bid-paddle {
    position: fixed;
    z-index: 65;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform-origin: bottom center;
    opacity: 0;
    pointer-events: none;
    animation: paddle-pop 1.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes paddle-pop {
    0%   { transform: translateY(16px) scale(0.5) rotate(-6deg); opacity: 0; }
    16%  { transform: translateY(-6px) scale(1.08) rotate(-4deg); opacity: 1; }
    26%  { transform: translateY(0) scale(1) rotate(-4deg); }
    74%  { transform: translateY(0) scale(1) rotate(-4deg); opacity: 1; }
    100% { transform: translateY(12px) scale(0.6) rotate(-6deg); opacity: 0; }
}
.bid-paddle-sign {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, #fff7e0, #ffe08a);
    color: #3a2c00;
    border: 3px solid #b98900;
    border-radius: 11px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}
.bid-paddle-stick {
    width: 7px;
    height: 22px;
    margin-top: -1px;
    background: linear-gradient(90deg, #7a5a1e, #a9803a, #7a5a1e);
    border-radius: 0 0 3px 3px;
}

/* --- Centered, unskippable winner takeover (≤3s) --- */
.win-takeover {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(6, 8, 20, 0.72);
    backdrop-filter: blur(3px);
}
.win-takeover.show { display: flex; }
.win-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 28px 52px;
    text-align: center;
    background:
        radial-gradient(circle at 50% 0%, rgba(255, 203, 71, 0.25), transparent 60%),
        linear-gradient(160deg, #1b2145, #12162e);
    border: 2px solid var(--gold);
    border-radius: 24px;
    box-shadow: 0 0 0 4px rgba(255, 203, 71, 0.15), 0 30px 80px rgba(0, 0, 0, 0.6);
    animation: takeover-pop 0.45s cubic-bezier(0.2, 1.4, 0.35, 1) both;
}
.win-card.forced {
    border-color: var(--accent-2);
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.18), 0 30px 80px rgba(0, 0, 0, 0.6);
}
.win-card.unsold {
    border-color: var(--border-strong);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.win-card.unsold .win-pic { filter: grayscale(0.7) drop-shadow(0 14px 22px rgba(0, 0, 0, 0.6)); }
@keyframes takeover-pop {
    0%   { transform: scale(0.4) rotate(-6deg); opacity: 0; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}
.win-flourish {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold);
}
.win-card.forced .win-flourish { color: var(--accent-2); }
.win-card.unsold .win-flourish { color: var(--muted); }
.win-pic {
    width: 160px;
    height: 160px;
    object-fit: contain;
    filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.6));
}
.win-name { font-size: 2.4rem; font-weight: 700; }
.win-sub { font-size: 1.25rem; color: var(--muted); }
.win-sub b { color: var(--text); }

/* Celebration confetti (raining paper) over a genuine win */
.confetti-piece {
    position: absolute;
    top: -16px;
    width: 9px;
    height: 14px;
    opacity: 0.95;
    pointer-events: none;
    animation-name: confetti-fall;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}
@keyframes confetti-fall {
    0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(105vh) rotate(680deg); opacity: 0.9; }
}

/* --- Owned-Pokémon hover card --- */
.mon-card {
    position: fixed;
    z-index: 70;
    width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px;
    background: linear-gradient(160deg, #1b2145, #12162e);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    box-shadow: var(--shadow);
    pointer-events: none;
}
.mon-card[hidden] { display: none; }
.mon-card-pic { width: 84px; height: 84px; object-fit: contain; }
.mon-card-body { text-align: center; }
.mon-card-title { font-weight: 700; font-size: 1.05rem; }
.mon-card-types { color: var(--muted); font-size: 0.85rem; }
.mon-card-roles { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.mon-card-stats { width: 100%; }
.mon-card-abilities { max-width: 100%; gap: 4px; }
.mon-card-abilities .ability-chip { padding: 3px 9px; font-size: 0.72rem; }
.mon-card-abilities .ability-chip.hidden::before { width: 13px; height: 13px; font-size: 0.58rem; }
.mon-card-nav {
    margin-top: 2px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
}

/* ===========================================================================
   Event hub (index.html) — one tile per event, plus empty slots for future ones
   ======================================================================== */
.hub-lead {
    max-width: 1240px;
    margin: 0 auto 16px;
    color: var(--muted);
}

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 14px;
}

.hub-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;

    color: inherit;
    text-decoration: none;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);

    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

a.hub-tile:hover {
    transform: translateY(-3px);
    background: var(--surface-2);
    border-color: var(--border-strong);
}
a.hub-tile:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.hub-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 54px;
    height: 54px;
    border-radius: 14px;
    color: var(--accent-2);
    background: var(--well);
    border: 1px solid var(--border);
}
.hub-icon svg { width: 30px; height: 30px; }

.hub-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.hub-head { display: flex; align-items: center; gap: 10px; }
.hub-name { font-weight: 700; font-size: 1.05rem; }
.hub-desc { color: var(--muted); font-size: 0.85rem; }

.hub-pill {
    margin-left: auto;
    flex: none;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--well);
    border: 1px solid var(--border);
    border-radius: 999px;
}
.hub-pill.live { color: var(--gold); border-color: var(--gold); background: var(--gold-soft); }
.hub-pill.soon { color: var(--accent-2); }

/* A slot waiting for a future event — visible but plainly inert. */
.hub-tile.empty {
    background: none;
    border-style: dashed;
    box-shadow: none;
    opacity: 0.45;
}
.hub-tile.empty .hub-icon { color: var(--muted); background: none; border-style: dashed; }
.hub-plus { font-size: 1.6rem; font-weight: 500; line-height: 1; }

/* Back to the hub, sitting in the header of an event page */
.back-link {
    padding: 7px 13px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
}
.back-link:hover { color: var(--text); border-color: var(--border-strong); }
