/*
 * TNV Auction — the signed-in website.
 *
 * Modelled on the CricAuction app: a deep red header, a white sheet with a rounded top edge
 * sliding under it, red gradient auction cards with gold icons, chunky striped action
 * buttons, and a bottom tab bar on phones. On a desktop the tabs move up into the header
 * and the sheet becomes a centred column, so the same pages read well at both sizes.
 *
 * The landing page and the admin panel have their own stylesheets; nothing here reaches them.
 */

:root {
    --red-950: #5c0d0b;
    --red-900: #7d1210;
    --red-800: #a11b14;
    --red-700: #b8261f;
    --red-600: #d0363a;
    --red-500: #e5484d;
    --red-400: #f0676a;
    --red-wash: #fdeeee;

    --green-700: #2f7d1c;
    --green-500: #58a83a;
    --green-wash: #e9f6e4;

    --gold: #ffc233;
    --gold-deep: #e7a300;
    --gold-wash: #fff6dc;

    --ink: #1c1b1f;
    --ink-soft: #3b3a40;
    --muted: #74737b;
    --line: #ebe9ee;
    --canvas: #f4f3f6;
    --paper: #ffffff;

    --amber: #b45309;
    --amber-wash: #fef3e2;
    --blue: #1d5fbf;
    --blue-wash: #e8f0fc;

    --radius: 14px;
    --radius-lg: 22px;
    --shadow: 0 6px 18px rgba(60, 12, 10, .10);
    --shadow-lift: 0 10px 26px rgba(60, 12, 10, .16);

    --display: "Fredoka", "Baloo 2", "Segoe UI", system-ui, sans-serif;
    --body: "Lexend", "Segoe UI", system-ui, sans-serif;

    --header-h: 58px;
    --tabs-h: 64px;

    /* Names the shared live and results fragments use inline. */
    --green: var(--green-700);
    --red: var(--red-600);
    --crimson: var(--red-700);
}

.acard-wrap { position: relative; }
[hidden] { display: none !important; }

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

html { -webkit-text-size-adjust: 100%; }

body.app {
    margin: 0;
    min-height: 100vh;
    background: var(--red-800);
    color: var(--ink);
    font: 400 15px/1.5 var(--body);
    -webkit-font-smoothing: antialiased;
}

/* Resets carry no specificity (:where), so any component class — .btn, .acard, .pill —
   sets its own colour and font without fighting them. */
:where(body.app) a { color: inherit; text-decoration: none; }
:where(body.app) img { max-width: 100%; display: block; }
:where(body.app) :is(h1, h2, h3, h4) {
    font-family: var(--display);
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
    text-wrap: balance;
}
:where(body.app) p { margin: 0; }
:where(body.app) :is(button, input, select, textarea) { font: inherit; color: inherit; }

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

/* ── Header ──────────────────────────────────────────────────────────────── */

.tb {
    position: sticky;
    top: 0;
    z-index: 40;
    background: linear-gradient(180deg, var(--red-800), var(--red-700));
    color: #fff;
}

.tb__in {
    height: var(--header-h);
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-family: var(--display);
    font-size: 1.45rem;
    font-weight: 400;
    letter-spacing: .01em;
    color: #fff;
    white-space: nowrap;
}
.brand img { width: 30px; height: 30px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); }
.brand b { font-weight: 700; }
.brand sup { font-size: .55em; font-weight: 600; margin-left: 1px; top: -.8em; }

.tb__nav { display: none; }

.tb__icons { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.icon-btn {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 1.35rem;
    cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, .14); }

/* ── The white sheet ─────────────────────────────────────────────────────── */

.sheet {
    position: relative;
    min-height: calc(100vh - var(--header-h));
    background: var(--paper);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 18px 16px calc(var(--tabs-h) + 28px);
}

.sheet__in { max-width: 1200px; margin: 0 auto; }

/* ── Bottom tabs (phones) ────────────────────────────────────────────────── */

.tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    height: var(--tabs-h);
    padding-bottom: env(safe-area-inset-bottom);
    background: #fff;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, .08);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
}

.tabs a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--ink-soft);
    font-size: .74rem;
    font-weight: 500;
}
.tabs a i { font-size: 1.35rem; line-height: 1; }
.tabs a.is-active { color: var(--red-700); font-weight: 600; }

@media (min-width: 992px) {
    .tb__in { height: 68px; }
    .tb__nav { display: flex; gap: 4px; margin-left: 28px; }
    .tb__nav a {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        padding: 9px 14px;
        border-radius: 999px;
        font-weight: 500;
        font-size: .92rem;
        color: rgba(255, 255, 255, .86);
    }
    .tb__nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
    .tb__nav a.is-active { background: #fff; color: var(--red-800); }

    .tabs { display: none; }
    /* The drawer repeats the header's own tabs, so the phone's menu button goes away. */
    .tb__icons [data-drawer] { display: none; }

    body.app { background: var(--canvas); }
    body.app .tb { box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
    .sheet {
        max-width: 1200px;
        margin: 22px auto 40px;
        border-radius: var(--radius-lg);
        padding: 28px 32px 36px;
        box-shadow: var(--shadow);
        min-height: 0;
    }
}

/* ── Drawer (the header menu) ────────────────────────────────────────────── */

.drawer {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
}
.drawer.is-open { display: block; }
.drawer__scrim { position: absolute; inset: 0; background: rgba(20, 4, 4, .45); }
.drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 86vw);
    background: #fff;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    box-shadow: -8px 0 30px rgba(0, 0, 0, .2);
}
.drawer__who { padding: 6px 8px 16px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.drawer__who b { display: block; font-family: var(--display); font-size: 1.15rem; font-weight: 600; }
.drawer__panel a, .drawer__panel button.link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 10px;
    border-radius: 10px;
    font-weight: 500;
    background: none;
    border: 0;
    text-align: left;
    cursor: pointer;
    width: 100%;
}
.drawer__panel a:hover { background: var(--canvas); }
.drawer__panel a i { font-size: 1.15rem; color: var(--red-700); width: 22px; text-align: center; }

/* ── Section headings ────────────────────────────────────────────────────── */

.sec-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 12px;
}
.sec-head h2 { font-family: var(--body); font-size: 1.02rem; font-weight: 500; color: var(--ink); }
.sec-head a { color: var(--red-700); font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; }

.page-title { font-size: clamp(1.4rem, 3.4vw, 1.9rem); margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: .92rem; margin-bottom: 20px; }

.block { margin-bottom: 28px; }

/* ── Auction cards ───────────────────────────────────────────────────────── */

.rail {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(290px, 86%);
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 2px 2px 12px;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    scrollbar-width: thin;
    scrollbar-color: #d9d7dc transparent;
}
.rail > * { scroll-snap-align: start; }

.cards {
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .cards { grid-template-columns: repeat(2, 1fr); }
    .rail { grid-auto-columns: minmax(320px, 46%); }
}
@media (min-width: 992px) {
    .cards { grid-template-columns: repeat(3, 1fr); }
    .rail { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); grid-auto-columns: auto; overflow: visible; margin: 0; padding: 2px 0 4px; }
}

.acard {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 236px;
    padding: 14px 16px 16px;
    border-radius: var(--radius);
    border: 1.5px solid #8e1a22;
    color: #fff;
    background:
        radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, .16), transparent 55%),
        linear-gradient(140deg, var(--red-400) 0%, var(--red-600) 48%, #b21c38 100%);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
}
.acard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }

.acard__top, .acard__foot {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--display);
    font-weight: 500;
    font-size: 1.12rem;
}
.acard__top { justify-content: space-between; padding-right: 26px; }
.acard__top span, .acard__foot span { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.acard i.gold { color: var(--gold); font-size: 1.2rem; }

.acard__body { display: flex; align-items: center; gap: 12px; flex: 1; }
.acard__logo {
    flex: 0 0 auto;
    width: 82px;
    height: 82px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, .85);
    background: #fff;
    display: grid;
    place-items: center;
    overflow: hidden;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .2);
}
.acard__logo img { width: 70%; height: 70%; object-fit: contain; }
.acard__name {
    font-family: var(--display);
    font-size: 1.18rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}
.acard__foot { font-size: 1.05rem; }

.team-dots { display: flex; flex-wrap: wrap; }
.team-dots span {
    width: 34px;
    height: 34px;
    margin-right: -4px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--green-500);
    border: 2px solid #fff;
    font: 600 .82rem var(--display);
    color: #fff;
}
.team-dots em {
    font-style: normal;
    font-size: .82rem;
    opacity: .9;
    align-self: center;
    margin-left: 10px;
}

.acard__flag {
    position: absolute;
    top: 4px;
    right: 8px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
    color: #fff;
    font-size: 1.3rem;
}
.acard__flag:hover { background: rgba(255, 255, 255, .16); }
.acard__flag .on, .acard__flag.is-on .off { display: none; }
.acard__flag.is-on .on { display: inline; color: var(--gold); }

.acard__status {
    position: absolute;
    left: 16px;
    bottom: 58px;
}

.acard--muted { background: linear-gradient(140deg, #8d8a93, #5f5c66); border-color: #4c4a52; }

/* ── Chunky action buttons ───────────────────────────────────────────────── */

.bigbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 22px 0; }

.bigbtn {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 58px;
    padding: 12px;
    border-radius: 10px;
    border: 2px solid #fff;
    font: 600 1.2rem var(--display);
    color: #fff;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .3);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .08), 0 5px 12px rgba(0, 0, 0, .18);
    overflow: hidden;
    cursor: pointer;
}
.bigbtn::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(115deg, rgba(255, 255, 255, .09) 0 14px, transparent 14px 34px);
    pointer-events: none;
}
.bigbtn:hover { filter: brightness(1.06); }
.bigbtn--red { background: linear-gradient(180deg, #c9504f, #8f1111); }
.bigbtn--green { background: linear-gradient(180deg, #74b04a, #2f7d1c); }

/* ── Promo strip ─────────────────────────────────────────────────────────── */

.promo {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    background: linear-gradient(100deg, var(--red-700), var(--red-950));
    color: #fff;
    margin-bottom: 26px;
}
.promo__text { flex: 1; min-width: 0; font-size: .86rem; line-height: 1.45; }
.promo__text b { font-family: var(--display); font-size: 1.02rem; font-weight: 600; }
.promo__tag {
    display: inline-block;
    padding: 1px 7px;
    margin-right: 6px;
    border-radius: 6px;
    background: #fff;
    color: var(--red-800);
    font: italic 700 .8rem var(--display);
}
.promo form { display: flex; gap: 6px; flex: 0 0 auto; }
.promo input {
    width: 110px;
    padding: 8px 10px;
    border: 0;
    border-radius: 7px;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 600;
    color: var(--ink);
}
.promo button {
    border: 0;
    border-radius: 7px;
    padding: 8px 12px;
    background: #fff;
    color: var(--red-800);
    font-weight: 600;
    cursor: pointer;
}
@media (max-width: 480px) {
    .promo { flex-wrap: wrap; }
    .promo form { width: 100%; }
    .promo input { flex: 1; width: auto; }
}

/* ── Panels, lists, stats ────────────────────────────────────────────────── */

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
}
.panel + .panel { margin-top: 14px; }
.panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.panel__head h3 { font-size: 1.12rem; }

.list { display: grid; }
.list__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 2px;
    border-top: 1px solid var(--line);
}
.list__row:first-child { border-top: 0; }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__meta { color: var(--muted); font-size: .82rem; }
.list__row img.thumb { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; background: var(--canvas); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
    background: var(--canvas);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}
.stat__value { font: 600 clamp(1.3rem, 4vw, 1.8rem) var(--display); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat__label { color: var(--muted); font-size: .76rem; font-weight: 500; margin-top: 4px; }
.stat--crimson .stat__value { color: var(--red-700); }

.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.kv div { display: flex; flex-direction: column; }
.kv span { color: var(--muted); font-size: .78rem; }
.kv b { font-weight: 600; font-variant-numeric: tabular-nums; }
@media (min-width: 768px) { .kv { grid-template-columns: repeat(4, 1fr); } }

/* ── Pills ───────────────────────────────────────────────────────────────── */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 600;
    white-space: nowrap;
    background: var(--canvas);
    color: var(--ink-soft);
}
.pill--live  { background: #fff; color: var(--red-700); }
.pill--live .dot, .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--red-600);
    animation: pulse 1.4s ease-in-out infinite;
}
.pill--red   { background: var(--red-wash); color: var(--red-700); }
.pill--green { background: var(--green-wash); color: var(--green-700); }
.pill--amber { background: var(--amber-wash); color: var(--amber); }
.pill--blue  { background: var(--blue-wash); color: var(--blue); }
.pill--soft  { background: var(--canvas); color: var(--muted); }
.pill--code  { background: var(--gold-wash); color: #8a6508; letter-spacing: .12em; }
.pill--onred { background: rgba(255, 255, 255, .2); color: #fff; }

@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
    .dot, .pill--live .dot { animation: none; }
    .acard { transition: none; }
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1.5px solid transparent;
    font-weight: 600;
    font-size: .92rem;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    transition: filter .15s ease, background .15s ease;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--red-700); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--red-800); }
.btn--green { background: var(--green-500); color: #fff; }
.btn--green:hover:not(:disabled) { background: var(--green-700); }
.btn--gold { background: var(--gold); color: var(--ink); }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover:not(:disabled) { border-color: var(--red-600); color: var(--red-700); }
.btn--danger { background: var(--red-wash); border-color: #f4c6c8; color: var(--red-700); }
.btn--danger:hover:not(:disabled) { background: #fbdcdd; border-color: var(--red-500); }
.btn--sm { padding: 7px 12px; font-size: .82rem; border-radius: 8px; }
.btn--lg { padding: 14px 22px; font-size: 1rem; }
.btn--block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Forms ───────────────────────────────────────────────────────────────── */

.field { margin-bottom: 14px; }
.field label { display: block; font-size: .84rem; font-weight: 500; color: var(--ink-soft); margin-bottom: 6px; }
.field .req { color: var(--red-600); }
.field input, .field select, .field textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: #fff;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--red-500);
    box-shadow: 0 0 0 3px rgba(229, 72, 77, .15);
}
.field__hint { color: var(--muted); font-size: .76rem; margin-top: 5px; }
.field-row { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
/* Short number fields sit two to a row even on a phone. */
@media (min-width: 340px) { .field-row--nums { grid-template-columns: 1fr 1fr; } }
@media (min-width: 560px) {
    .field-row--2 { grid-template-columns: 1fr 1fr; }
    .field-row--3 { grid-template-columns: repeat(3, 1fr); }
}
.form-section {
    font: 600 .8rem var(--body);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--red-700);
    margin: 22px 0 12px;
}
.form-section:first-child { margin-top: 0; }

.input-reveal { position: relative; }
.input-reveal input { padding-right: 46px; }
.input-reveal button {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 1.1rem;
    cursor: pointer;
}

.alert { padding: 11px 14px; border-radius: 10px; font-size: .88rem; margin-bottom: 14px; }
.alert--error { background: var(--red-wash); color: var(--red-700); }
.alert--info  { background: var(--gold-wash); color: #7a5a06; }
.alert--ok    { background: var(--green-wash); color: var(--green-700); }

/* Segmented control — Player / Auctioneer, Live / Upcoming / Done. */
.seg {
    display: inline-flex;
    padding: 4px;
    gap: 4px;
    border-radius: 12px;
    background: var(--canvas);
    margin-bottom: 16px;
    max-width: 100%;
    overflow-x: auto;
}
.seg button, .seg a {
    border: 0;
    background: none;
    padding: 8px 16px;
    border-radius: 9px;
    font-weight: 500;
    font-size: .88rem;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
}
.seg .is-active { background: #fff; color: var(--red-700); font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }

/* ── Sign-in pages ───────────────────────────────────────────────────────── */

body.app.auth-page { background: linear-gradient(180deg, var(--red-800), var(--red-950)); }
.auth {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 36px 16px 40px;
}
.auth .brand { margin-bottom: 26px; font-size: 1.7rem; }
.auth .brand img { width: 38px; height: 38px; }
.auth__card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 26px 22px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}
.auth__card--wide { max-width: 620px; }
.auth__card h1 { font-size: 1.6rem; text-align: center; margin-bottom: 4px; }
.auth__card .lead { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: 22px; }
.auth__foot { color: rgba(255, 255, 255, .85); font-size: .88rem; margin-top: 20px; text-align: center; }
.auth__foot a { color: #fff; text-decoration: underline; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .82rem; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* ── Empty states, toast, dialog ─────────────────────────────────────────── */

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty i { font-size: 2.4rem; color: #d4d1d8; display: block; margin-bottom: 10px; }
.empty h3 { color: var(--ink-soft); font-size: 1.08rem; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tabs-h) + 18px);
    transform: translateX(-50%);
    z-index: 80;
    max-width: min(92vw, 460px);
    padding: 12px 18px;
    border-radius: 12px;
    background: var(--ink);
    color: #fff;
    font-size: .9rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
    transition: opacity .2s ease, transform .2s ease;
}
.toast--ok { background: var(--green-700); }
.toast--error { background: var(--red-700); }
.toast.is-out { opacity: 0; transform: translate(-50%, 10px); }
@media (min-width: 992px) { .toast { bottom: 28px; } }

dialog.sheet-dialog {
    width: min(560px, 94vw);
    max-height: 90vh;
    padding: 0;
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
    color: var(--ink);
}
dialog.sheet-dialog::backdrop { background: rgba(20, 4, 4, .5); }
.dlg__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}
.dlg__head h3 { font-size: 1.15rem; }
.dlg__body { padding: 16px 18px; overflow-y: auto; max-height: calc(90vh - 140px); }
.dlg__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; }
.dlg__close { border: 0; background: none; font-size: 1.3rem; cursor: pointer; color: var(--muted); }

/* ── Small helpers ───────────────────────────────────────────────────────── */

.muted { color: var(--muted); }
.center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-0 { margin-bottom: 0 !important; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.grid { display: grid; gap: 14px; }
.grid--2 { grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid--2 { grid-template-columns: 1fr 1fr; } }
.meter { height: 6px; background: var(--canvas); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--red-600); border-radius: 999px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.auction__name { font-family: var(--display); font-weight: 600; font-size: 1.05rem; }
.auction__meta { color: var(--muted); font-size: .82rem; }
.copy {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--canvas);
    font-size: .82rem;
}
.copy code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Consolas, monospace; }
/* Grid and flex children may shrink below their content, so a long link truncates instead of
   pushing the page sideways. */
.grid > *, .copy, .list__row > * { min-width: 0; }

/* ── Live auction (shared by the live view and the console) ──────────────── */

.live-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 16px;
    margin-bottom: 16px;
    border-radius: var(--radius);
    color: #fff;
    background: linear-gradient(120deg, var(--red-600), var(--red-900));
}
.live-head h1 { font-size: clamp(1.2rem, 3vw, 1.6rem); }
.live-head .meta { font-size: .84rem; opacity: .85; }

/* Connection state on a red header: a light pill, with the colour carried by the dot. */
.conn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .74rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    color: #fff;
}
.conn::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #d4d2d8; }
.conn--live::before { background: #86e070; box-shadow: 0 0 0 3px rgba(134, 224, 112, .28); }
.conn--wait::before { background: var(--gold); }
.conn--down::before { background: #ff9d9d; }

.anchor-video {
    width: 100%;
    max-height: 420px;
    background: #0b0f19;
    border-radius: var(--radius);
    margin-bottom: 16px;
    object-fit: cover;
}

.break-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border-radius: var(--radius);
    background: var(--gold-wash);
    border: 1px solid var(--gold);
    color: #6b4f05;
}
.break-banner img { width: 32px; height: 32px; opacity: .6; }

.live-grid { display: grid; gap: 16px; }
@media (min-width: 992px) { .live-grid { grid-template-columns: 5fr 7fr; align-items: start; } }

.lot {
    text-align: center;
    padding: 20px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #fff, #fff7f7);
}
.lot__photo {
    width: 170px;
    max-width: 60%;
    aspect-ratio: 1;
    object-fit: cover;
    margin: 0 auto 14px;
    border-radius: 18px;
    border: 3px solid #fff;
    box-shadow: var(--shadow);
    background: var(--canvas);
}
.lot__name { font: 600 1.7rem var(--display); margin: 0 0 2px; }
.lot__role { color: var(--muted); font-size: .92rem; }
.lot__label { color: var(--muted); font-size: .74rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.lot__price {
    font: 700 clamp(2rem, 7vw, 2.8rem) var(--display);
    color: var(--red-700);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.lot__leader { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; font-weight: 600; }
.lot__leader img { width: 26px; height: 26px; border-radius: 8px; object-fit: cover; }
.lot__timer { margin-top: 12px; font: 600 1.5rem var(--display); font-variant-numeric: tabular-nums; }
.lot__timer .is-urgent, .is-urgent { color: var(--red-600); }
.lot .chips { justify-content: center; }
.lot .empty img { width: 56px; height: 56px; margin: 0 auto 12px; opacity: .45; }

.teams { display: grid; gap: 10px; }
@media (min-width: 560px) { .teams { grid-template-columns: 1fr 1fr; } }
.team { padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; }
.team--leading { border-color: var(--green-500); background: #f6fcf3; }
.team__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.team__head img { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; }
.team__name { font-weight: 600; font-size: .92rem; }
.team__meta { color: var(--muted); font-size: .76rem; }

.feed { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.feed__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    background: var(--canvas);
    font-size: .88rem;
}
.feed__row b { font-variant-numeric: tabular-nums; }
.feed__team { display: flex; align-items: center; gap: 9px; min-width: 0; }
.feed__team img { width: 24px; height: 24px; border-radius: 7px; object-fit: cover; flex: 0 0 auto; }

/* The console: floor-bid buttons, one per team. */
.bid-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.bid-tile {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    text-align: left;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
}
.bid-tile:hover:not(:disabled) { border-color: var(--red-500); box-shadow: 0 4px 12px rgba(208, 54, 58, .15); }
.bid-tile:disabled { cursor: not-allowed; background: var(--canvas); }
.bid-tile.is-leading { border-color: var(--green-500); background: #f6fcf3; }
.bid-tile__head { display: flex; align-items: center; gap: 9px; min-width: 0; }
.bid-tile__head img { width: 32px; height: 32px; border-radius: 9px; object-fit: cover; }
.bid-tile__cta { font: 600 1rem var(--display); color: var(--red-700); }
.bid-tile:disabled .bid-tile__cta { color: var(--muted); }

.console { display: grid; gap: 16px; }
@media (min-width: 1100px) { .console { grid-template-columns: 340px 1fr; align-items: start; } }
.console__video {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: #0b0f19;
    aspect-ratio: 16 / 10;
}
.console__video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.console__off {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px;
    text-align: center;
    color: rgba(255, 255, 255, .7);
    background: radial-gradient(120% 100% at 50% 0%, #1c2233, #0b0f19);
}
.console__off i { font-size: 2rem; opacity: .55; margin-bottom: 4px; }
.console__off span { font-weight: 600; color: #fff; }
.console__off small { font-size: .78rem; }
@media (max-width: 1099px) { .console__video { aspect-ratio: 16 / 9; } }
.console__video .on-air { position: absolute; top: 10px; left: 10px; }
.controls { display: grid; gap: 8px; }
.controls .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* The final squads. */
.results-grid { display: grid; gap: 14px; }
@media (min-width: 768px) { .results-grid { grid-template-columns: 1fr 1fr; } }


/* ── Live motion ──────────────────────────────────────────────────────────────
   Every push from the server re-renders the board, so an entrance animation on a
   piece of it plays exactly when that piece changes: a new player slides in, a new
   price pops, the newest bid drops into the feed. Nothing loops except the last-ten-
   seconds timer, and all of it stops for anyone who asked for less motion. */

@keyframes lot-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes price-pop { 0% { transform: scale(.92); opacity: .5; } 60% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }
@keyframes feed-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes urgent-beat { 50% { opacity: .35; transform: scale(1.06); } }
@keyframes stamp-in { 0% { opacity: 0; transform: rotate(-24deg) scale(1.8); } 70% { opacity: 1; transform: rotate(-12deg) scale(.95); } 100% { transform: rotate(-12deg) scale(1); } }

.lot__photo, .lot__name, .lot__role { animation: lot-in .38s ease both; }
.lot__name { animation-delay: .04s; }
.lot__role { animation-delay: .08s; }
.lot__price { animation: price-pop .32s ease both; }
.lot__leader { animation: lot-in .4s ease both .06s; }
.feed__row:first-child { animation: feed-in .36s ease both; }
.meter > span { transition: width .45s cubic-bezier(.4, 0, .2, 1); }
.team--leading { box-shadow: 0 0 0 3px rgba(88, 168, 58, .18); }
.lot__timer .is-urgent { display: inline-block; animation: urgent-beat .9s ease-in-out infinite; }

/* The hammer falling: a stamp across the player's photo. */
.lot { position: relative; overflow: hidden; }
.sold-stamp {
    position: absolute;
    top: 18%;
    left: 50%;
    translate: -50% 0;
    padding: 6px 26px;
    border: 4px solid var(--green-700);
    border-radius: 10px;
    color: var(--green-700);
    font: 700 clamp(1.6rem, 6vw, 2.4rem) var(--display);
    letter-spacing: .12em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, .78);
    animation: stamp-in .45s cubic-bezier(.2, .9, .3, 1.2) both;
    pointer-events: none;
}
.sold-stamp--unsold { border-color: var(--red-600); color: var(--red-600); }

@media (prefers-reduced-motion: reduce) {
    .lot__photo, .lot__name, .lot__role, .lot__price, .lot__leader, .feed__row:first-child,
    .sold-stamp, .lot__timer .is-urgent { animation: none; }
    .meter > span { transition: none; }
}


/* ── The live stage ───────────────────────────────────────────────────────────
   The player on the block, the price and the clock, on one dark panel so the
   numbers carry across a hall and over a stream. Used by the public live view and
   by the auctioneer's console. */

.stage {
    position: relative;
    overflow: hidden;
    display: grid;
    gap: 18px;
    align-items: center;
    padding: 22px;
    border-radius: var(--radius-lg);
    color: #fff;
    background:
        radial-gradient(90% 120% at 12% 0%, rgba(255, 194, 51, .18), transparent 55%),
        linear-gradient(135deg, #7d1210 0%, #a11b14 45%, #4a0b0a 100%);
    box-shadow: var(--shadow-lift);
}
.stage::after {
    content: "";
    position: absolute;
    inset: -40% -10% auto;
    height: 70%;
    background: radial-gradient(closest-side, rgba(255, 255, 255, .12), transparent);
    animation: stage-sheen 7s ease-in-out infinite alternate;
    pointer-events: none;
}
@keyframes stage-sheen { from { transform: translateX(-12%); } to { transform: translateX(12%); } }

@media (min-width: 900px) {
    .stage { grid-template-columns: minmax(0, 1.25fr) minmax(0, .95fr) auto; padding: 26px 28px; }
}

.stage--sold { background: radial-gradient(90% 120% at 12% 0%, rgba(134, 224, 112, .22), transparent 55%), linear-gradient(135deg, #14532d 0%, #2f7d1c 45%, #0b2e18 100%); }
.stage--unsold { background: linear-gradient(135deg, #3f3d45 0%, #5f5c66 45%, #2a282e 100%); }
.stage--idle { background: linear-gradient(135deg, #5c0d0b, #7d1210); }

.stage__idle { grid-column: 1 / -1; text-align: center; padding: 26px 10px; }
.stage__idle i { font-size: 2.4rem; opacity: .5; display: block; margin-bottom: 10px; }
.stage__idle h2 { font-size: 1.4rem; margin-bottom: 4px; }
.stage__idle p { color: rgba(255, 255, 255, .72); font-size: .9rem; }

.stage__who { display: flex; align-items: center; gap: 16px; min-width: 0; }

.stage__photo { position: relative; flex: 0 0 auto; }
.stage__photo img {
    width: clamp(92px, 22vw, 148px);
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 20px;
    border: 3px solid rgba(255, 255, 255, .85);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .35);
    background: var(--canvas);
    animation: lot-in .4s ease both;
}
.stage__stamp {
    position: absolute;
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    padding: 4px 16px;
    border: 4px solid #7ee06a;
    border-radius: 8px;
    background: rgba(9, 32, 16, .72);
    color: #c9f7bd;
    font: 700 1.25rem var(--display);
    letter-spacing: .1em;
    text-transform: uppercase;
    animation: stamp-in .45s cubic-bezier(.2, .9, .3, 1.2) both;
}
.stage__stamp--out { border-color: #ff9d9d; color: #ffd7d7; background: rgba(40, 10, 10, .72); }

.stage__meta { min-width: 0; }
.stage__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .8);
}
.stage__name {
    font: 600 clamp(1.5rem, 4.2vw, 2.7rem) var(--display);
    line-height: 1.1;
    margin: 4px 0 8px;
    overflow-wrap: anywhere;
    animation: lot-in .4s ease both .05s;
}
.stage__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    font-size: .76rem;
    font-weight: 500;
}
.chip--gold { background: var(--gold); color: #4a2c00; font-weight: 700; }
.stage__base { margin-top: 10px; font-size: .82rem; color: rgba(255, 255, 255, .78); }
.stage__base b { color: #fff; }

.stage__money { text-align: center; min-width: 0; }
.stage__label {
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .78);
}
.stage__price {
    font: 700 clamp(2.4rem, 8vw, 4.2rem) var(--display);
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
    color: var(--gold);
    text-shadow: 0 4px 18px rgba(0, 0, 0, .35);
    animation: price-pop .32s ease both;
}
.stage--sold .stage__price { color: #c9f7bd; }
.stage__leader {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    font-weight: 600;
    animation: lot-in .4s ease both .06s;
}
.stage__leader img { width: 24px; height: 24px; border-radius: 7px; object-fit: cover; }
.stage__next { margin-top: 8px; font-size: .84rem; color: rgba(255, 255, 255, .8); }
.stage__next b { color: #fff; }

/* The countdown: a ring that empties, with the seconds in the middle. */
.stage__clock { position: relative; width: 104px; height: 104px; margin: 0 auto; }
.stage__clock svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring__track { fill: none; stroke: rgba(255, 255, 255, .18); stroke-width: 9; }
.ring__bar {
    fill: none;
    stroke: var(--gold);
    stroke-width: 9;
    stroke-linecap: round;
    stroke-dasharray: 327;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset .25s linear, stroke .25s ease;
}
.stage__clock span {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font: 600 1.5rem var(--display);
    font-variant-numeric: tabular-nums;
}
.stage__clock.is-urgent .ring__bar { stroke: #ff8b8b; }
.stage__clock.is-urgent span { color: #ffd7d7; animation: urgent-beat .9s ease-in-out infinite; }

.stage--console { padding: 18px; }
.stage--console .stage__name { font-size: clamp(1.3rem, 3vw, 2rem); }
.stage--console .stage__price { font-size: clamp(2rem, 5vw, 3.2rem); }

/* ── Team cards ───────────────────────────────────────────────────────────── */

.tgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.tcard {
    position: relative;
    padding: 14px;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.tcard--leading { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(88, 168, 58, .16); }
.tcard__flag {
    position: absolute;
    top: -9px;
    right: 12px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--green-500);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.tcard__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tcard__head img { width: 38px; height: 38px; border-radius: 11px; object-fit: cover; flex: 0 0 auto; }
.tcard__name { font-weight: 600; }
.tcard__meta { color: var(--muted); font-size: .76rem; }
.tcard__purse { display: flex; align-items: baseline; justify-content: space-between; font-size: .82rem; margin-bottom: 6px; }
.tcard__purse span { color: var(--muted); }
.tcard__purse b { font-variant-numeric: tabular-nums; }
.tcard__slots { display: flex; gap: 4px; margin-top: 10px; }
.tcard__slots i { width: 100%; height: 5px; border-radius: 999px; background: var(--canvas); }
.tcard__slots i.is-filled { background: var(--red-500); }

@media (prefers-reduced-motion: reduce) {
    .stage::after, .stage__photo img, .stage__name, .stage__price, .stage__leader,
    .stage__stamp, .stage__clock.is-urgent span { animation: none; }
    .ring__bar { transition: none; }
}
