/* HaxEndCard - the match end card shell (doc 45). Global, not .razor.css: scoped CSS is not wired in
   this project. Values from the approved mock (HaxopolyDesign/samples/end-card/end-card-mock.htm). */

.hax-endcard-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(11, 20, 55, 0.65);
    /* The Haxopoly overlay's safe-centring rule (operator 2026-09-26): clear the app bar, and scroll
       so the top of a tall card is always reachable. */
    padding: calc(var(--mud-appbar-height, 64px) + 12px) 16px 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: hax-endcard-fade 200ms ease-out both; /* beat 1, 0 ms - a sound bit may go here */
}

.hax-endcard {
    margin: auto;
    position: relative;
    width: 100%;
    max-width: 560px;
    /* A module may supply its own colour (EndCardModel.SurfaceColorHex - Lexigon #170f04); core's
       default is near-black. Fallback at the point of use, never on :root. */
    background: var(--hax-endcard-surface, #05080D);
    color: #FFFFFF;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: hax-endcard-rise 320ms 80ms cubic-bezier(.2, .8, .3, 1) both; /* beat 2, 80 ms - a sound bit may go here */
}

/* The dialog takes focus on open (for Escape and screen readers); it is not a control, so no ring. */
.hax-endcard:focus { outline: none; }

/* ---- banner: colour follows the viewer's result; the words say it too ---- */
.hax-endcard-band {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 52px 18px 22px;
}

.hax-endcard-band::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 12px;
}

.hax-endcard.is-win .hax-endcard-band { background: #3E6B2C; }
.hax-endcard.is-win .hax-endcard-band::before { background: #A3E635; }
.hax-endcard.is-loss .hax-endcard-band { background: #7F1D1D; }
.hax-endcard.is-loss .hax-endcard-band::before { background: #F87171; }

.hax-endcard-band-icon { width: 44px; height: 44px; margin-left: 6px; flex-shrink: 0; }
.hax-endcard-band-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hax-endcard-outcome { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
/* One size step down on every card (operator 2026-11-28, Armada One round 2: was 1.3rem / 1.1rem phone). */
.hax-endcard-headline { font-size: 1.1rem; font-weight: 500; line-height: 1.2; }

.hax-endcard-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: 0;
    color: #FFFFFF;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.hax-endcard-close:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }

/* ---- body: grows down as far as it needs ---- */
.hax-endcard-body {
    container-type: inline-size;
    padding: 18px 18px 6px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hax-endcard-players { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

.hax-endcard-player {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .12);
}

.hax-endcard-player.is-winner { background: rgba(163, 230, 53, .10); border-color: rgba(163, 230, 53, .45); }

.hax-endcard-disc { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.hax-endcard-disc img { width: 70%; height: 70%; object-fit: contain; }
.hax-endcard-avatar { flex-shrink: 0; }

/* 8px between name, figure and detail (operator 2026-11-27, Lexigon sample round 4; was 3px). */
.hax-endcard-info { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.hax-endcard-name { font-weight: 700; font-size: .92rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.hax-endcard-pill {
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #14181F;
    background: #A3E635;
    padding: 2px 8px;
    border-radius: 999px;
}

/* The label sits on the figure's vertical centre, not its baseline (operator 2026-11-27). */
.hax-endcard-figure { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hax-endcard-figure-label { color: #A3E635; font-weight: 700; font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; }
.hax-endcard-figure-value { font-weight: 800; font-size: 1.6rem; font-variant-numeric: tabular-nums; line-height: 1; }
.hax-endcard-detail { color: #C7CFDC; font-size: .8rem; font-variant-numeric: tabular-nums; }

/* ---- rosettes: one inside the winner card on a phone; on a wider card two flank the winner card,
        level with it (operator 2026-11-27) - absolutely placed outside the card, in a gutter the
        players column leaves on each side ---- */
.hax-endcard-rosette { display: block; width: 100%; height: 100%; }
.hax-endcard-player.is-winner { padding-right: 60px; }
.hax-endcard-rosette-inline { position: absolute; right: 10px; top: 50%; width: 40px; height: 52px; margin-top: -26px; }
.hax-endcard-rosette-flank { display: none; position: absolute; top: 50%; width: 48px; height: 62px; margin-top: -31px; }
.hax-endcard-rosette-flank.is-left { left: -60px; }
.hax-endcard-rosette-flank.is-right { right: -60px; }
.hax-endcard-rosette-inline .hax-endcard-rosette,
.hax-endcard-rosette-flank .hax-endcard-rosette { animation: hax-endcard-pop 360ms 450ms cubic-bezier(.3, 1.6, .5, 1) both; } /* beat 3, 450 ms - a sound bit may go here */

@container (min-width: 480px) {
    .hax-endcard-players { margin: 0 64px; }
    .hax-endcard-rosette-flank { display: block; }
    .hax-endcard-rosette-inline { display: none; }
    .hax-endcard-player.is-winner { padding-right: 14px; }
}

/* ---- callout: toned down (operator 2026-11-26) - a faint gold wash on black, light text ---- */
.hax-endcard-callout {
    background: rgba(224, 179, 65, .08);
    color: #E8ECF2;
    border-left: 3px solid #C9A13B;
    border-radius: 4px;
    padding: 9px 14px;
    font-size: .9rem;
}

/* ---- Highlights table (Lexigon 2026-11-27): no panel of its own - a gold edge and row rules on
        the card's colour; value columns centred (operator) ---- */
.hax-endcard-stats { border-left: 3px solid #C9A13B; padding: 4px 0 2px 14px; }
.hax-endcard-stats table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.hax-endcard-stats thead th { font-weight: 700; padding: 0 0 6px; color: #FFFFFF; text-align: center; overflow-wrap: anywhere; }
.hax-endcard-stats thead th:first-child { text-align: left; color: #E0B341; letter-spacing: .1em; text-transform: uppercase; font-size: .78rem; }
.hax-endcard-stats tbody th { text-align: left; font-weight: 400; color: #C7CFDC; padding: 7px 8px 7px 0; vertical-align: top; border-top: 1px solid rgba(255, 255, 255, .12); }
.hax-endcard-stats td { width: 32%; text-align: center; vertical-align: top; padding: 7px 0; border-top: 1px solid rgba(255, 255, 255, .12); color: #E8ECF2; }
.hax-endcard-stat-value { display: block; font-weight: 700; font-size: 1rem; font-variant-numeric: tabular-nums; color: #FFFFFF; overflow-wrap: anywhere; }
.hax-endcard-stat-detail { display: block; font-size: .76rem; color: #C7CFDC; margin-top: 2px; }
.hax-endcard-stat-none { color: #8C96A6; }

/* ---- status table (Armada One 2026-11-28; sample ArmadaOneDesign/samples/end-card): a bordered
        panel in the message box's tint; each thing named once on the left, rows transparent with
        rules between them (operator); a state per player - icon block + right-aligned words ---- */
.hax-endcard-status {
    background: rgba(0, 0, 0, .28);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 8px;
    padding: 8px 12px;
}
/* Fixed columns (operator round 4): both players get the same width, so their states wrap at the same
   places; the names column is narrow and wraps early ("Command / Center") to give the players room. */
.hax-endcard-status table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.hax-endcard-status col.is-label { width: 24%; }
.hax-endcard-status col.is-player { width: 38%; }
.hax-endcard-status thead th { padding: 2px 0 8px; text-align: center; font-size: .95rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #FFFFFF; overflow-wrap: anywhere; }
.hax-endcard-status tbody th { text-align: left; font-weight: 600; font-size: .85rem; line-height: 1.15; color: #E8ECF2; padding: 7px 8px 7px 0; overflow-wrap: break-word; }
.hax-endcard-status tbody tr + tr > * { border-top: 1px solid rgba(255, 255, 255, .10); }
.hax-endcard-status td { padding: 7px 0 7px 8px; }
/* A faint rule between the two players' columns (operator round 3: "their content blends together"). */
.hax-endcard-status thead th:last-child, .hax-endcard-status td:last-child { border-left: 1px solid rgba(255, 255, 255, .12); padding-left: 10px; }
/* Every block in the same place, the words centred beside it (operator round 3). */
.hax-endcard-status-cell { display: grid; grid-template-columns: 26px minmax(0, 1fr); align-items: center; gap: 8px; }
.hax-endcard-status-text:only-child { grid-column: 1 / -1; }
.hax-endcard-status-icon {
    flex-shrink: 0; width: 26px; height: 26px; border-radius: 4px; display: grid; place-items: center;
    background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .18);
}
.hax-endcard-status-icon img { width: 20px; height: 20px; display: block; }
.hax-endcard-status-text { text-align: center; font-size: .8rem; line-height: 1.15; color: #E8ECF2; }
.hax-endcard-status-text.is-lost { color: #F0997B; }
.hax-endcard-status-text.is-kept { color: #8FB8F0; }
/* The table's title (Gladiator Chess "Setup recap", 2026-11-29), styled like the Highlights title. */
.hax-endcard-status thead td.hax-endcard-status-title { text-align: left; vertical-align: bottom; padding: 2px 0 8px; color: #E0B341; letter-spacing: .1em; text-transform: uppercase; font-size: .78rem; font-weight: 700; }
/* Aligned layout (Gladiator Chess, operator 2026-11-29; sample GladiatorChess/samples/end-card):
   icons in one bare column - each icon carries its own background - and the words left beside them;
   an empty slot holds the column on a row with no icon. Headings start over the icon column - indented
   to the words they left a 440 px phone too little room ("YAHOOM / AN", Chrome check 2026-11-29). */
.hax-endcard-status.is-start .hax-endcard-status-icon { background: none; border: 0; }
.hax-endcard-status.is-start .hax-endcard-status-icon img { width: 24px; height: 24px; }
.hax-endcard-status.is-start .hax-endcard-status-icon.is-empty { visibility: hidden; }
.hax-endcard-status.is-start .hax-endcard-status-text { text-align: left; }
.hax-endcard-status.is-start thead th { text-align: left; }

.hax-endcard-chart-title { display: flex; justify-content: space-between; align-items: baseline; font-size: .85rem; color: #C7CFDC; margin-bottom: 4px; }
.hax-endcard-chart-title b { color: #FFFFFF; font-weight: 600; }

/* ---- the last post (doc 45 section 6; mock section 4): on the card's black, no panel ---- */
.hax-endcard-thread { border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 12px; font-size: .88rem; color: #C7CFDC; }
.hax-endcard-thread b { color: #FFFFFF; }

.hax-endcard-post { margin-top: 8px; background: #2A2F3D; border-radius: 8px; padding: 8px 12px; color: #FFFFFF; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.hax-endcard-post.is-viewer { background: #123A2A; }
.hax-endcard-post-who { color: #C7CFDC; font-size: .78rem; }

.hax-endcard-box {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 8px;
    background: #0A1626;
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 6px;
    padding: 10px;
    font: inherit;
    resize: none;
}

/* On a module colour the thread's two solid fills become tints, so they blend with it. */
.hax-endcard.has-surface .hax-endcard-post { background: rgba(0, 0, 0, .22); }
.hax-endcard.has-surface .hax-endcard-post.is-viewer { background: rgba(163, 230, 53, .12); }
.hax-endcard.has-surface .hax-endcard-box { background: rgba(0, 0, 0, .28); }

.hax-endcard-box:focus-visible { outline: 2px solid #A3E635; outline-offset: 1px; }
.hax-endcard-thread-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; font-size: .78rem; }
.hax-endcard-thread-meta span:last-child { white-space: nowrap; }
.hax-endcard-thread-note { margin-top: 6px; font-size: .78rem; }
.hax-endcard-thread-error { margin-top: 6px; font-size: .82rem; color: #FCA5A5; }

/* ---- footer ---- */
.hax-endcard-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px 18px; }

.hax-endcard-btn {
    font: inherit;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    border-radius: 6px;
    padding: 9px 18px;
    cursor: pointer;
    border: 1px solid transparent;
}

.hax-endcard-btn-primary { background: #A3E635; color: #14181F; }
.hax-endcard-btn-primary:disabled { opacity: .6; cursor: default; }
.hax-endcard-btn-text { background: transparent; color: #FFFFFF; }
.hax-endcard-btn:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }

/* ---- phone: tighter type (the mock's 440 px values) ---- */
@media (max-width: 599.98px) {
    .hax-endcard-headline { font-size: 1rem; }
    .hax-endcard-figure-value { font-size: 1.3rem; }
}

/* ---- entrance beats ---- */
@keyframes hax-endcard-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hax-endcard-rise { from { opacity: 0; transform: translateY(24px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes hax-endcard-pop { from { opacity: 0; transform: scale(.4) rotate(-12deg); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    .hax-endcard-overlay,
    .hax-endcard,
    .hax-endcard-rosette-inline .hax-endcard-rosette,
    .hax-endcard-rosette-flank .hax-endcard-rosette { animation: none; }
}
