/*
 * Interface de jeu : bandeau (HUD), navigation (barre d'onglets en bas sur mobile), tuiles, en-têtes de page,
 * transitions entre les pages, notifications, nom gravé. Chargée après app.css (voir base.html.twig). Le ludus, sa
 * fenêtre « Santé » et l'arène ont leur feuille (ludus.css, health.css, arena.css).
 * Icônes : SVG au trait en masque (mask-image), colorées par currentColor (survol, onglet actif).
 */

:root {
    --hud-h: 4.6rem;
    --header-height: var(--hud-h);
    --hud-bg: linear-gradient(180deg, #1d150f 0%, #120d0a 100%);
}

/* ---------- Icônes en masque ---------- */

.icon {
    display: inline-block;
    flex: none;
    width: 1.35rem;
    height: 1.35rem;
    background-color: currentColor;
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
}

.icon-ludus { --icon: url("../images/nav-ludus-w8WAG7x.svg"); }
.icon-arena { --icon: url("../images/nav-arena-Ot8deCJ.svg"); }
.icon-history { --icon: url("../images/nav-history-5XUjbaj.svg"); }
.icon-account { --icon: url("../images/nav-account-CzIFOzj.svg"); }
.icon-heart { --icon: url("../images/icon-heart-Tk11PwA.svg"); }
.icon-coin { --icon: url("../images/icon-coin-24VysRE.svg"); }
.icon-market { --icon: url("../images/icon-market-_AdjXX5.svg"); }
.icon-city { --icon: url("../images/icon-city-GEllSmZ.svg"); }
.icon-need-hunger { --icon: url("../images/icon-need-hunger-ltKZO9R.svg"); }
.icon-need-thirst { --icon: url("../images/icon-need-thirst-UT4GKTv.svg"); }
.icon-need-rest { --icon: url("../images/icon-need-rest-MMVLMnK.svg"); }
.icon-need-health { --icon: url("../images/icon-need-health-uuLdNcq.svg"); }
.icon-need-morale { --icon: url("../images/icon-need-morale-at1Gngr.svg"); }
.icon-laurel { --icon: url("../images/icon-laurel-KwQQoxN.svg"); }
.icon-palm { --icon: url("../images/icon-palm-0I8slzU.svg"); }
.icon-skull { --icon: url("../images/icon-skull-w85vfcl.svg"); }
.icon-helmet { --icon: url("../images/icon-helmet-NSf-Il9.svg"); }
.icon-equipment { --icon: url("../images/slot-body-QALobHW.svg"); }
.icon-logout { --icon: url("../images/icon-logout-DpzbVYD.svg"); }
.icon-shield { --icon: url("../images/icon-shield-to69XK5.svg"); }
.icon-back { --icon: url("../images/icon-back-Jj3GEC3.svg"); }
.icon-columns { --icon: url("../images/icon-columns-GEWT64h.svg"); }
.icon-chisel { --icon: url("../images/icon-chisel-Z2g3YzW.svg"); }
.icon-domain { --icon: url("../images/domain-plan-yZe2tIb.svg"); }
.icon-standard { --icon: url("../images/icon-standard-yl09bKR.svg"); }
.icon-scroll { --icon: url("../images/icon-scroll-Na5Uen1.svg"); }
.icon-chest { --icon: url("../images/icon-chest-R3CCNL7.svg"); }

/* ---------- Bandeau commun (visiteur et joueur) : fond opaque, filet doré ---------- */

.site-header {
    background: var(--hud-bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: 1px solid #4a3523;
    border-image: none;
    box-shadow: 0 10px 28px rgb(0 0 0 / 55%);
}

.site-header::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--line-strong) 18%, var(--bronze) 50%, var(--line-strong) 82%, transparent);
    pointer-events: none;
}

.site-header-visitor {
    min-height: var(--hud-h);
}

/* ---------- HUD du joueur ---------- */

.hud {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto auto auto;
    align-items: center;
    gap: 0 clamp(0.75rem, 2vw, 1.5rem);
    height: var(--hud-h);
    min-height: 0;
    padding: 0 clamp(1rem, 3vw, 2rem);
}

.hud-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--gold);
    text-decoration: none;
    border-radius: 8px;
}

.hud-brand-emblem {
    width: 2.6rem;
    height: 2.6rem;
    filter: drop-shadow(0 0 10px rgb(224 112 44 / 40%));
    transition: transform 0.2s ease, filter 0.2s ease;
}

.hud-brand:hover .hud-brand-emblem {
    transform: rotate(-6deg) scale(1.06);
    filter: drop-shadow(0 0 14px rgb(224 112 44 / 65%));
}

.hud-brand-text {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.3rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.hud-brand:hover {
    color: #fff0c4;
}

/* Gladiateur en médaillon, puis la bourse, puis le profil */
.hud-champion {
    grid-column: -5;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
    padding: 0.3rem 1rem 0.3rem 0.3rem;
    color: var(--sand);
    text-decoration: none;
    background: linear-gradient(180deg, rgb(0 0 0 / 30%), rgb(0 0 0 / 50%));
    border: 1px solid color-mix(in srgb, var(--rarity) 45%, var(--line));
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 5%);
    transition: border-color 0.15s ease, box-shadow 0.2s ease, transform 0.12s ease;
}

.hud-champion:hover {
    color: var(--sand);
    border-color: var(--rarity);
    box-shadow: 0 0 18px color-mix(in srgb, var(--rarity) 30%, transparent);
}

.hud-champion:active {
    transform: translateY(1px);
}

.hud-medallion {
    position: relative;
    flex: none;
    display: block;
    width: 2.9rem;
    height: 2.9rem;
    overflow: hidden;
    border: 2px solid var(--rarity, var(--bronze));
    border-radius: 50%;
    background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--rarity, var(--bronze)) 40%, #1a120c), #0b0806 75%);
    box-shadow: 0 0 0 2px #0e0a08, 0 0 14px color-mix(in srgb, var(--rarity, var(--bronze)) 45%, transparent);
}

/* Le portrait est en pied (4:5) : on cadre le visage */
.hud-medallion img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 0;
    transform: scale(2.5);
    transform-origin: 50% 7%;
}

.hud-champion-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    line-height: 1.15;
}

.hud-champion-name {
    overflow: hidden;
    max-width: 11rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.98rem;
    letter-spacing: 0.05em;
    color: var(--gold);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hud-champion-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.hud-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.hud-stat .icon {
    width: 0.95rem;
    height: 0.95rem;
}

.hud-stat-hp {
    color: #ff9a85;
}

.hud-stat-win {
    color: var(--gold);
}

.hud-stat-loss {
    color: var(--sand-dim);
}

/* Menu du compte */
.hud-account {
    /* Toujours tout à droite, même sans onglets ni médaillon (pas de gladiateur vivant) */
    grid-column: -2;
    justify-self: end;
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    color: var(--sand-dim);
    cursor: pointer;
    background: rgb(0 0 0 / 35%);
    border: 1px solid rgb(201 151 63 / 35%);
    border-radius: 50%;
    transition: color 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease, transform 0.12s ease;
}

.hud-account .icon {
    width: 1.55rem;
    height: 1.55rem;
}

.hud-account:hover,
.hud-account.is-active,
.hud-account:has(+ .hud-menu:popover-open) {
    color: var(--gold);
    border-color: var(--bronze);
    box-shadow: 0 0 14px rgb(201 151 63 / 35%);
}

.hud-account:active {
    transform: translateY(1px);
}

.hud-menu {
    position: fixed;
    inset: auto;
    top: calc(var(--hud-h) + 0.4rem);
    right: clamp(1rem, 3vw, 2rem);
    width: min(18rem, calc(100vw - 2rem));
    margin: 0;
    padding: 0.5rem;
    color: var(--sand);
    background:
        url("../images/noise-5lpaXVc.svg"),
        linear-gradient(180deg, #2a1e16, #150f0b);
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / 50%), inset 0 1px 0 rgb(243 211 138 / 12%), var(--shadow-deep);
}

.hud-menu-head {
    display: flex;
    flex-direction: column;
    margin: 0 0 0.35rem;
    padding: 0.55rem 0.75rem 0.7rem;
    border-bottom: 1px solid var(--line);
    line-height: 1.3;
}

.hud-menu-hint {
    font-family: var(--font-display);
    font-size: 0.66rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--sand-mute);
}

.hud-menu .site-nav-user {
    overflow: hidden;
    color: var(--bronze-light);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hud-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 2.9rem;
    padding: 0.5rem 0.75rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--sand);
    border-radius: 8px;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.hud-menu-item .icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--bronze-light);
}

.hud-menu-item:hover,
.hud-menu-item:focus-visible {
    color: var(--gold);
    background-color: rgb(201 151 63 / 12%);
}

.hud-menu-logout {
    margin-top: 0.35rem;
    border-top: 1px solid var(--line);
    border-radius: 0 0 8px 8px;
    color: var(--danger-text);
}

.hud-menu-logout .icon {
    color: currentColor;
}

.hud-menu-logout:hover {
    color: #ffc2b6;
    background-color: rgb(163 36 26 / 18%);
}

/* ---------- Mobile : bandeau compact, navigation en barre d'onglets en bas ---------- */

@media (max-width: 52rem) {
    :root {
        --hud-h: 3.9rem;
    }

    .hud {
        grid-template-columns: auto minmax(0, 1fr) auto auto auto auto;
        gap: 0 0.65rem;
        padding: 0 0.85rem;
    }

    .hud-brand-emblem {
        width: 2.3rem;
        height: 2.3rem;
    }

    .hud-champion {
        justify-self: end;
    }

    .hud-champion {
        max-width: 100%;
        padding-right: 0.8rem;
    }

    .hud-champion-name {
        max-width: none;
        font-size: 0.9rem;
    }

    .hud-medallion {
        width: 2.55rem;
        height: 2.55rem;
    }

    .hud-account {
        width: 2.55rem;
        height: 2.55rem;
    }

    .hud-menu {
        right: 0.85rem;
    }
}

@media (max-width: 26rem) {
    .hud-brand-text {
        display: none;
    }
}

@media (min-width: 26.01rem) and (max-width: 52rem) {
    .hud-brand-text {
        font-size: 1.05rem;
        letter-spacing: 0.16em;
    }
}

/* ---------- Retour et en-têtes de page ---------- */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0 0 1rem;
    padding: 0.3rem 0.85rem 0.3rem 0.5rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--bronze-light);
    background: rgb(0 0 0 / 28%);
    border: 1px solid rgb(201 151 63 / 30%);
    border-radius: 999px;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.back-link .icon {
    width: 0.95rem;
    height: 0.95rem;
    transition: transform 0.15s ease;
}

.back-link:hover {
    color: var(--gold);
    background-color: rgb(201 151 63 / 10%);
    border-color: var(--bronze);
}

.back-link:hover .icon {
    transform: translateX(-2px);
}

.page-header::after {
    content: '';
    display: block;
    height: 1px;
    margin-top: 1.25rem;
    background: linear-gradient(90deg, var(--bronze), rgb(201 151 63 / 25%) 40%, transparent 80%);
}

.page-header .section-eyebrow {
    margin-bottom: 0.35rem;
}

[id] {
    scroll-margin-top: calc(var(--hud-h) + 1rem);
}

/* ---------- Tuiles d'action ---------- */

.ludus-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.25rem;
}

/* Une tuile qui envoie un formulaire (l'exhibition, D75) : le formulaire s'efface, le bouton est la tuile */
.tile-form {
    display: contents;
}

button.tile {
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.tile {
    position: relative;
    flex: 1 1 13rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    min-height: 6.25rem;
    padding: 1rem 1.2rem;
    color: var(--sand);
    text-decoration: none;
    background:
        url("../images/noise-5lpaXVc.svg"),
        radial-gradient(ellipse 80% 70% at 0% 0%, rgb(224 112 44 / 10%), transparent 70%),
        linear-gradient(180deg, var(--stone-2), var(--ink-2));
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgb(243 211 138 / 9%), 0 14px 30px rgb(0 0 0 / 45%);
    transition: transform 0.18s cubic-bezier(0.2, 0.7, 0.2, 1), border-color 0.18s ease, box-shadow 0.2s ease, filter 0.18s ease;
}

.tile:hover,
.tile:focus-visible {
    color: var(--sand);
    border-color: var(--bronze);
    transform: translateY(-3px);
    box-shadow: inset 0 1px 0 rgb(243 211 138 / 14%), 0 20px 40px rgb(0 0 0 / 55%), 0 0 26px rgb(224 112 44 / 16%);
}

.tile:active {
    transform: translateY(0) scale(0.985);
    transition-duration: 0.08s;
}

.tile-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 3.4rem;
    height: 3.4rem;
    color: var(--gold);
    background: radial-gradient(circle, rgb(224 112 44 / 20%), rgb(0 0 0 / 40%) 70%);
    border: 1px solid rgb(201 151 63 / 50%);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgb(14 10 8 / 60%), 0 0 0 5px rgb(201 151 63 / 20%);
    transition: box-shadow 0.2s ease, color 0.2s ease;
}

.tile-icon .icon {
    width: 1.75rem;
    height: 1.75rem;
}

.tile:hover .tile-icon {
    color: #fff0c4;
    box-shadow: 0 0 0 4px rgb(14 10 8 / 60%), 0 0 0 5px rgb(201 151 63 / 45%), 0 0 18px rgb(224 112 44 / 40%);
}

.tile-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.tile-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold);
}

.tile-text {
    font-size: 0.95rem;
    line-height: 1.35;
    color: var(--sand-dim);
}

.tile.outcome-victory .tile-text {
    color: var(--gold);
}

.tile.outcome-defeat .tile-text {
    color: var(--danger-text);
}

/* Action principale : rouge sang, comme le bouton principal */
.tile-primary {
    flex: 2 1 20rem;
    min-height: 7rem;
    background:
        url("../images/noise-5lpaXVc.svg"),
        radial-gradient(ellipse 70% 90% at 15% 0%, rgb(255 170 90 / 28%), transparent 65%),
        linear-gradient(180deg, #a8301d 0%, #7d1810 60%, #5a0f09 100%);
    border-color: #d98a4a;
    box-shadow: inset 0 1px 0 rgb(255 214 170 / 35%), inset 0 -2px 0 rgb(0 0 0 / 25%), 0 16px 34px rgb(107 18 12 / 45%);
}

.tile-primary:hover,
.tile-primary:focus-visible {
    border-color: #f0b070;
    filter: brightness(1.08);
    box-shadow: inset 0 1px 0 rgb(255 214 170 / 45%), 0 22px 44px rgb(107 18 12 / 55%), 0 0 34px rgb(224 112 44 / 35%);
}

.tile-primary .tile-title {
    font-size: 1.4rem;
    color: #fff3df;
    text-shadow: 0 2px 0 rgb(60 10 5 / 70%);
}

.tile-primary .tile-text {
    color: #f6d8c4;
}

.tile-primary .tile-icon {
    width: 4rem;
    height: 4rem;
    color: #fff0c4;
    background: radial-gradient(circle, rgb(255 200 120 / 28%), rgb(60 8 4 / 60%) 70%);
    border-color: rgb(255 214 170 / 55%);
    box-shadow: 0 0 0 4px rgb(60 8 4 / 45%), 0 0 0 5px rgb(255 214 170 / 25%);
}

.tile-primary .tile-icon .icon {
    width: 2.1rem;
    height: 2.1rem;
}

.tile-cta {
    flex: none;
    margin-left: auto;
    padding: 0.5rem 1rem;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #fff3df;
    background: rgb(0 0 0 / 22%);
    border: 1px solid rgb(255 214 170 / 50%);
    border-radius: 999px;
    transition: background-color 0.18s ease;
}

.tile-primary:hover .tile-cta {
    background-color: rgb(255 214 170 / 16%);
}

/*
 * Trois tuiles (D64 : arène, équipement, mémoire) : une seule rangée à toute largeur de bureau, l'arène plus large ;
 * sur petit bureau, les tuiles secondaires posent leur icône au-dessus du texte et l'arène range son bouton.
 */
@media (min-width: 52.0625rem) {
    .ludus-actions:has(> .tile:nth-child(3)) {
        display: grid;
        grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 52.0625rem) and (max-width: 72rem) {
    .ludus-actions:has(> .tile:nth-child(3)) > .tile:not(.tile-primary) {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .ludus-actions:has(> .tile:nth-child(3)) .tile-cta {
        display: none;
    }
}

.tile-memorial .tile-icon {
    color: #e9b4a8;
    border-color: rgb(208 64 46 / 45%);
    background: radial-gradient(circle, rgb(163 36 26 / 25%), rgb(0 0 0 / 45%) 70%);
}

.tile-memorial .tile-title {
    color: #e9cfc2;
}

@media (max-width: 52rem) {
    .ludus-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .tile {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.65rem;
        min-height: 0;
        padding: 0.95rem;
    }

    .tile-primary {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
    }

    /* Tuile secondaire seule sur sa ligne (nombre pair de tuiles, ex. recruter et la nécropole) : pleine largeur, en ligne */
    .ludus-actions > .tile:not(.tile-primary):last-child:nth-child(even) {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
    }

    .tile-title {
        font-size: 0.98rem;
    }

    .tile-text {
        font-size: 0.88rem;
    }

    .tile-icon {
        width: 2.9rem;
        height: 2.9rem;
    }

    .tile-icon .icon {
        width: 1.5rem;
        height: 1.5rem;
    }

    .tile-primary .tile-title {
        font-size: 1.2rem;
    }

    .tile-primary .tile-icon {
        width: 3.4rem;
        height: 3.4rem;
    }
}

@media (max-width: 26rem) {
    .tile-cta {
        display: none;
    }
}

/* ---------- Transitions entre les pages (View Transitions, sans JavaScript) ---------- */

@media (prefers-reduced-motion: no-preference) {
    @view-transition {
        navigation: auto;
    }

    /* Le bandeau reste en place ; seul le contenu change */
    .site-header {
        view-transition-name: hud;
    }

    .site-main {
        view-transition-name: page;
    }

    /* Un fondu bref : le jeu doit répondre tout de suite (0,15 s en tout) */
    ::view-transition-group(page) {
        animation-duration: 0.15s;
    }

    ::view-transition-old(page) {
        animation: page-out 0.08s ease-in both;
    }

    ::view-transition-new(page) {
        animation: page-in 0.15s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    }

    ::view-transition-old(hud),
    ::view-transition-new(hud) {
        animation-duration: 0.1s;
    }

    /* Menu du compte : apparition douce */
    .hud-menu {
        transition: opacity 0.16s ease, transform 0.16s ease, overlay 0.16s allow-discrete, display 0.16s allow-discrete;
        opacity: 0;
        transform: translateY(-6px);
    }

    .hud-menu:popover-open {
        opacity: 1;
        transform: none;
    }

    @starting-style {
        .hud-menu:popover-open {
            opacity: 0;
            transform: translateY(-6px);
        }
    }

    /* backwards : l'animation finie ne bloque pas le transform du survol */
    .tile {
        animation: rise-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
    }

    .tile:nth-child(2) {
        animation-delay: 0.06s;
    }

    .tile:nth-child(3) {
        animation-delay: 0.12s;
    }

    .tile:nth-child(4) {
        animation-delay: 0.18s;
    }

    .tile:nth-child(5) {
        animation-delay: 0.24s;
    }
}

@keyframes page-out {
    to {
        opacity: 0;
        transform: translateY(-6px);
    }
}

@keyframes page-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

@keyframes flame {
    from {
        transform: scale(1, 1);
    }

    to {
        transform: scale(0.9, 1.12);
    }
}

/* Bourse du ludus (D23), entre le médaillon et le profil */
.hud-purse {
    grid-column: -4;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 2.4rem;
    padding: 0 0.85rem 0 0.6rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
    color: #f3d38a;
    background: linear-gradient(180deg, rgb(201 151 63 / 16%), rgb(0 0 0 / 30%));
    border: 1px solid rgb(201 151 63 / 40%);
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgb(243 211 138 / 14%);
    font-variant-numeric: tabular-nums;
}

.hud-purse .icon {
    width: 1.3rem;
    height: 1.3rem;
    color: #e9b949;
    filter: drop-shadow(0 0 5px rgb(233 185 73 / 45%));
}

@media (max-width: 52rem) {
    .hud-purse {
        height: 2.2rem;
        padding: 0 0.6rem 0 0.45rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 26rem) {
    /* Téléphone étroit : le médaillon ne garde que le portrait et le nom */
    .hud-champion-stats {
        display: none;
    }
}

/* Or gagné (D23) : pièce dorée devant le montant */
.gold-amount {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
    color: #f3d38a;
    font-variant-numeric: tabular-nums;
}

.gold-amount::before {
    content: '';
    width: 1.15em;
    height: 1.15em;
    background-color: #e9b949;
    -webkit-mask: url("../images/icon-coin-24VysRE.svg") center / contain no-repeat;
    mask: url("../images/icon-coin-24VysRE.svg") center / contain no-repeat;
}

.history-gold {
    grid-column: 2;
    font-size: 0.85rem;
}

@media (max-width: 40rem) {
    .history-gold {
        grid-column: auto;
    }
}

/* ---------- Notifications flottantes (succès, erreur) : par-dessus la page, sans la décaler ---------- */
.toasts {
    position: fixed;
    inset: auto;
    top: calc(var(--hud-h, 4.6rem) + 0.75rem);
    right: 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.6rem;
    width: min(100vw - 2rem, 24rem);
    max-height: calc(100dvh - 6rem);
    margin: 0;
    padding: 0;
    overflow: visible;
    color: inherit;
    background: none;
    border: 0;
    pointer-events: none;
}

.toasts:not(:popover-open) {
    display: none;
}

.toasts .flash {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    width: 100%;
    margin: 0;
    padding: 0.85rem 2.6rem 0.85rem 0.9rem;
    font-size: 0.95rem;
    line-height: 1.4;
    pointer-events: auto;
    background:
        url("../images/noise-5lpaXVc.svg"),
        linear-gradient(180deg, #2a1d14, #15100c);
    border: 1px solid var(--line-strong);
    border-left-width: 4px;
    border-radius: 12px;
    box-shadow: 0 18px 40px rgb(0 0 0 / 60%), 0 0 0 1px rgb(0 0 0 / 40%);
}

.toasts .flash::before {
    content: '';
    flex: none;
    width: 1.35rem;
    height: 1.35rem;
    margin-top: 0.05rem;
    border-radius: 50%;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 0.8rem;
}

.toasts .flash-success {
    color: #eaf6e3;
    border-color: rgb(109 171 91 / 45%);
    border-left-color: #6dab5b;
}

.toasts .flash-success::before {
    background-color: #3f7a32;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5 6.5 12 13 4.5' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    box-shadow: 0 0 12px rgb(109 171 91 / 55%);
}

.toasts .flash-error {
    color: #ffe4dc;
    border-color: rgb(208 64 46 / 50%);
    border-left-color: #d0402e;
}

.toasts .flash-error::before {
    background-color: #a3241a;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 3.5v5.5' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='12.3' r='1.4' fill='%23fff'/%3E%3C/svg%3E");
    box-shadow: 0 0 12px rgb(208 64 46 / 55%);
}

.toast-close {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    cursor: pointer;
    background: none;
    border: 0;
    border-radius: 50%;
    opacity: 0.6;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.toast-close::before,
.toast-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.75rem;
    height: 2px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
}

.toast-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.toast-close:hover,
.toast-close:focus-visible {
    opacity: 1;
    background: rgb(255 255 255 / 8%);
}

@media (prefers-reduced-motion: no-preference) {
    .toasts .flash.is-in {
        animation: toast-in 0.38s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
    }

    .toasts .flash.is-out {
        animation: toast-out 0.28s ease-in both;
    }
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(2.5rem);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(2.5rem);
    }
}

@media (max-width: 40rem) {
    .toasts {
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
    }
}

/* ---------- Nom de l'écurie gravé dans la pierre (D37) ----------
 * Même pierre que la stèle de la Mémoire : calcaire chaud, lettres creusées en capitales romaines. Une lettre creusée
 * reçoit la lumière (venue d'en haut à gauche) sur sa paroi basse-droite et reste dans l'ombre sur sa paroi
 * haute-gauche : arête sombre en haut à gauche, arête claire en bas à droite, fond de taille plus sombre que la pierre.
 */

.carved {
    --cut: #5f523f;
    --cut-light: rgb(255 248 232 / 70%);
    --cut-dark: rgb(28 20 12 / 75%);
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--cut);
    /* Paroi haute-gauche dans l'ombre, paroi basse-droite dans la lumière ; décalage en em : la taille suit la lettre */
    text-shadow:
        -0.045em -0.045em 0 var(--cut-dark),
        0.04em 0.04em 0 var(--cut-light),
        0 0 0.02em rgb(0 0 0 / 30%);
}

.carved-word {
    display: inline-block;
    white-space: nowrap;
}

.carved-letter {
    display: inline-block;
}

/* La renommée sur la plaque de l'éditeur du domaine (D49) : une ligne gravée sous son titre (ici plutôt que dans
 * domain.css : la renommée a ses styles au même endroit) */
.domain-bar-renown {
    margin: 0.15rem 0 0;
    font-family: var(--font-display);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: var(--bronze-light);
    white-space: nowrap;
    cursor: help;
}

/* Confirmation : « Graver dans la pierre ? », cadre de bronze sombre, le nom sur une bande de pierre, le verdict du
 * serveur dessous. Une seule colonne centrée. Fenêtre ancrée en haut : ce qui apparaît avec le verdict s'ajoute
 * dessous sans rien déplacer au-dessus. */
.stone-dialog {
    width: min(100vw - 2rem, 30rem);
    margin: min(14vh, 7rem) auto auto;
    padding: 0;
    color: var(--sand);
    background: transparent;
    border: 0;
    overflow: visible;
}

.stone-dialog::backdrop {
    background: radial-gradient(ellipse at center, rgb(20 8 6 / 50%), rgb(0 0 0 / 78%));
}

.stone-dialog-frame {
    /* Rien à copier ici : le texte de la fenêtre ne doit pas finir collé dans la plaque */
    -webkit-user-select: none;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.35rem clamp(1rem, 4vw, 1.5rem) 1.15rem;
    text-align: center;
    background:
        radial-gradient(ellipse at 50% -20%, rgb(224 112 44 / 20%), transparent 60%),
        url("../images/noise-5lpaXVc.svg"),
        linear-gradient(180deg, #2a1d14, #100b08);
    border: 2px solid color-mix(in srgb, var(--bronze) 60%, var(--line));
    border-radius: 16px;
    box-shadow: 0 0 0 6px rgb(14 10 8 / 80%), 0 0 0 7px rgb(201 151 63 / 22%), 0 40px 90px rgb(0 0 0 / 75%);
}

.stone-dialog-eyebrow {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--sand-dim);
}

/* Titre court (une ligne, même à 390 px), qui change avec un refus */
.stone-dialog-title {
    margin: 0.2rem 0 0.95rem;
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 4.6vw, 1.7rem);
    line-height: 1.2;
    white-space: nowrap;
    color: var(--gold);
    text-shadow: 0 0 22px rgb(224 112 44 / 30%), 0 2px 0 rgb(0 0 0 / 60%);
}

/* Bande de pierre : le nom sur une seule ligne, la taille des lettres suit leur nombre (--letters, posé par le
 * contrôleur), points de suspension en dernier recours */
.stone-dialog-name {
    position: relative;
    align-self: stretch;
    margin: 0;
    padding: 0.65rem 0.9rem;
    container-type: inline-size;
    background-color: #a39479;
    background-image: linear-gradient(180deg, #c4b69d, #a39479);
    border: 1px solid #5d5242;
    border-radius: 4px;
    box-shadow:
        inset 0 2px 0 rgb(255 246 228 / 45%),
        inset 0 -3px 0 rgb(0 0 0 / 28%),
        inset 0 0 0 5px rgb(0 0 0 / 8%),
        inset 0 0 0 6px rgb(255 246 228 / 25%),
        0 8px 18px rgb(0 0 0 / 55%);
    transition: filter 0.25s ease;
}

.stone-dialog-name-text {
    --letters: 12;
    display: block;
    overflow: hidden;
    font-size: clamp(0.72rem, calc(100cqi / (var(--letters) * 0.68)), 1.45rem);
    /* Hauteur fixe : la bande ne change pas de taille d'un nom à l'autre */
    line-height: 1.95rem;
    letter-spacing: 0.06em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Refusé : la pierre ternit et se fend en travers du nom (fissure dessinée, lèvres sombre et claire) */
.stone-dialog[data-state='unavailable'] .stone-dialog-name {
    filter: saturate(0.35) brightness(0.86);
}

.stone-dialog-name::after {
    content: '';
    position: absolute;
    inset: 0.35rem 0.5rem;
    pointer-events: none;
    opacity: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 40' preserveAspectRatio='none'%3E%3Cpath d='M0 22 L28 20 L47 23 L70 18 L96 22 L118 17 L141 23 L166 19 L190 22 L214 17 L240 21 L263 18 L300 21' fill='none' stroke='%23fff6e4' stroke-opacity='.35' stroke-width='1.1' transform='translate(0 1.2)'/%3E%3Cpath d='M0 22 L28 20 L47 23 L70 18 L96 22 L118 17 L141 23 L166 19 L190 22 L214 17 L240 21 L263 18 L300 21' fill='none' stroke='%232a1d12' stroke-opacity='.75' stroke-width='1.3' stroke-linejoin='bevel'/%3E%3Cpath d='M70 18 L75 12 M166 19 L171 25 M240 21 L245 16' fill='none' stroke='%232a1d12' stroke-opacity='.6' stroke-width='.8'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    transition: opacity 0.25s ease;
}

.stone-dialog[data-state='unavailable'] .stone-dialog-name::after {
    opacity: 1;
}

/* Verdict du serveur : un sceau et une ligne gravée, sur la colonne centrale */
.stone-dialog-verdict {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    max-width: 24rem;
    min-height: 2.6rem;
    margin: 0.8rem 0 0;
    font-family: var(--font-display);
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.35;
    color: var(--sand-dim);
}

.stone-dialog-verdict::before {
    content: '';
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
}

.stone-dialog-verdict.is-checking {
    flex-direction: row;
    justify-content: center;
    gap: 0.55rem;
    font-style: italic;
    font-weight: 600;
    color: var(--sand-mute);
}

.stone-dialog-verdict.is-checking::before {
    background: radial-gradient(circle at 40% 35%, #6d5a45, #2a1f17);
    border: 1px solid rgb(201 151 63 / 35%);
}

@media (prefers-reduced-motion: no-preference) {
    .stone-dialog-verdict.is-checking::before {
        animation: verdict-wait 0.9s ease-in-out infinite alternate;
    }
}

@keyframes verdict-wait {
    from {
        opacity: 0.45;
    }

    to {
        opacity: 1;
    }
}

.stone-dialog-verdict.is-available {
    flex-direction: row;
    justify-content: center;
    gap: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #b9d79a;
}

.stone-dialog-verdict.is-available::before {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f2ffe0' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 62% no-repeat,
        radial-gradient(circle at 38% 32%, #8fb06a, #4d6b33 60%, #2b3d1c);
    border: 1px solid #a9c98a;
    box-shadow: 0 0 12px rgb(143 176 106 / 45%), inset 0 1px 0 rgb(255 255 255 / 25%);
}

/* Refusé : un petit sceau de cire au-dessus, la raison en écriture courante, ocre rouge, comme gravée */
.stone-dialog-verdict.is-unavailable {
    font-family: var(--font-body);
    font-size: 1.02rem;
    font-style: italic;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: #d9a07e;
    text-shadow: 0 1px 0 rgb(0 0 0 / 60%);
}

.stone-dialog-verdict.is-unavailable::before {
    width: 1.35rem;
    height: 1.35rem;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f4d9c8' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M8.5 8.5l7 7M15.5 8.5l-7 7'/%3E%3C/svg%3E") center / 60% no-repeat,
        radial-gradient(circle at 38% 32%, #a8513c, #6e2618 62%, #451309);
    border: 1px solid rgb(217 160 126 / 55%);
    box-shadow: 0 1px 2px rgb(0 0 0 / 60%), inset 0 1px 0 rgb(255 255 255 / 18%);
}

.stone-dialog-verdict.is-unknown {
    font-family: var(--font-body);
    font-style: italic;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--sand-mute);
}

.stone-dialog-verdict.is-unknown::before {
    display: none;
}

/* Suite de la fenêtre selon le verdict : rien pendant la consultation ; ni phrase ni Graver si le nom est refusé */
.stone-dialog-after {
    display: flex;
    flex-direction: column;
    align-items: center;
    align-self: stretch;
}

.stone-dialog[data-state='checking'] .stone-dialog-after,
.stone-dialog[data-state='unavailable'] .stone-dialog-text,
.stone-dialog[data-state='unavailable'] [data-stable-plaque-target='confirmButton'] {
    display: none;
}

@media (prefers-reduced-motion: no-preference) {
    .stone-dialog-after {
        animation: stone-dialog-fade 0.2s ease-out both;
    }

    .stone-dialog[data-state='unavailable'] .stone-dialog-title {
        animation: stone-dialog-fade 0.25s ease-out both;
    }
}

@keyframes stone-dialog-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.stone-dialog-text {
    margin: 0.55rem 0 0;
    color: var(--sand-dim);
}

.stone-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem 0.8rem;
    margin-top: 1.05rem;
}

.stone-dialog[data-state='unavailable'] .stone-dialog-actions {
    margin-top: 0.85rem;
}

/* Refusé : Corriger devient l'action principale */
.stone-dialog[data-state='unavailable'] [data-stable-plaque-target='editButton'] {
    color: #fff3df;
    background: linear-gradient(180deg, #bd3a24 0%, #921d12 55%, #6b120c 100%);
    border-color: #d98a4a;
    box-shadow: inset 0 1px 0 rgb(255 214 170 / 35%), inset 0 -2px 0 rgb(0 0 0 / 25%), 0 10px 26px rgb(107 18 12 / 45%);
}

.stone-dialog-revert {
    flex-basis: 100%;
    margin-top: -0.1rem;
    padding: 0.25rem;
    font: inherit;
    font-size: 0.92rem;
    color: var(--sand-mute);
    text-decoration: underline;
    text-underline-offset: 0.2em;
    cursor: pointer;
    background: none;
    border: 0;
}

.stone-dialog-revert:hover,
.stone-dialog-revert:focus-visible {
    color: var(--gold);
}

.stone-dialog-actions .button:disabled {
    cursor: not-allowed;
    filter: grayscale(0.7) brightness(0.7);
    box-shadow: none;
}

@media (prefers-reduced-motion: no-preference) {
    .stone-dialog[open] .stone-dialog-frame {
        animation: stone-dialog-in 0.22s cubic-bezier(0.2, 0.8, 0.3, 1) both;
    }
}

@keyframes stone-dialog-in {
    from {
        opacity: 0;
        transform: translateY(0.6rem) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Menu du compte : les lieux du ludus (D64), sous le nom de l'écurie, en attendant la page du ludus */
.hud-menu-ludus {
    display: flex;
    flex-direction: column;
    margin: 0.2rem 0 0.35rem;
    padding: 0 0 0.35rem;
    border-bottom: 1px solid var(--line);
}

/* Sur un petit écran couché, le menu défile plutôt que de sortir de l'écran */
.hud-menu {
    max-height: calc(100dvh - var(--hud-h) - 1rem);
    overflow-y: auto;
}

/* Menu du compte : le nom de l'écurie en tête */
.hud-menu-stable {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0.55rem 0.75rem 0.1rem;
    line-height: 1.3;
}

/* Petites tablettes de pierre (menu du compte, page du compte) : le même nom gravé, sans ciselage */
.hud-menu-stable-name,
.account-stable-name {
    display: inline-block;
    max-width: 100%;
    margin-top: 0.25rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.92rem;
    line-height: 1.3;
    background: linear-gradient(180deg, #c4b69d, #a39479);
    border: 1px solid #5d5242;
    border-radius: 3px;
    box-shadow: inset 0 1px 0 rgb(255 246 228 / 45%), inset 0 -2px 0 rgb(0 0 0 / 25%), 0 2px 6px rgb(0 0 0 / 45%);
}

.hud-menu-stable-invite {
    color: var(--gold);
}

/* ---------- Le sélecteur des gladiateurs (D67) ----------
   À partir de deux vivants, le médaillon est un bouton (même aspect que le lien) qui ouvre un popover natif : une plaque
   par gladiateur, posée sur une tablette de pierre sombre cerclée de bronze (sans grain). Le choisi porte un liseré
   d'or. Sur grand écran, le sélecteur s'accroche sous le médaillon (positionnement par ancre, sinon à droite) ; sur
   téléphone, il prend la largeur de l'écran. */

button.hud-champion {
    font: inherit;
    text-align: start;
    cursor: pointer;
    appearance: none;
}

.hud-champion-several {
    position: relative;
    anchor-name: --hud-champion;
}

.hud-champion-several:has(+ .hud-roster:popover-open) {
    border-color: var(--rarity);
    box-shadow: 0 0 18px color-mix(in srgb, var(--rarity) 30%, transparent);
}

/* Le nombre de gladiateurs, petit jeton de bronze au pied du médaillon */
.hud-roster-count {
    position: absolute;
    left: 2.35rem;
    bottom: 0.05rem;
    display: grid;
    place-items: center;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.25rem;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.66rem;
    line-height: 1;
    color: #2e1c08;
    background: linear-gradient(160deg, #f6d998 0%, #c08a42 55%, #85591f 100%);
    border: 1px solid #3f280c;
    border-radius: 999px;
    box-shadow: inset 1px 1px 0 rgb(255 244 214 / 55%), 0 1px 3px rgb(0 0 0 / 65%);
}

.hud-roster {
    position: fixed;
    inset: auto;
    top: calc(var(--hud-h) + 0.4rem);
    right: clamp(1rem, 3vw, 2rem);
    width: min(22rem, calc(100vw - 2rem));
    max-height: calc(100dvh - var(--hud-h) - 1rem);
    overflow-y: auto;
    margin: 0;
    padding: 0.6rem;
    color: var(--sand);
    background: linear-gradient(170deg, #3a2f27 0%, #251d18 45%, #16110d 100%);
    border: 1px solid #85591f;
    border-radius: 14px;
    box-shadow:
        inset 0 0 0 1px rgb(0 0 0 / 55%),
        inset 1px 1px 0 rgb(246 217 152 / 18%),
        0 0 0 1px rgb(0 0 0 / 40%),
        6px 14px 30px rgb(0 0 0 / 60%);
}

@supports (position-anchor: --hud-champion) {
    @media (min-width: 52.0625rem) {
        .hud-roster {
            position-anchor: --hud-champion;
            top: calc(anchor(bottom) + 0.45rem);
            right: anchor(right);
        }
    }
}

.hud-roster-head {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin: 0 0 0.5rem;
    padding: 0.35rem 0.55rem 0.55rem;
    border-bottom: 1px solid rgb(192 138 66 / 35%);
    line-height: 1.3;
}

.hud-roster-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gold);
}

.hud-roster-hint {
    font-size: 0.8rem;
    color: var(--sand-dim);
}

.hud-roster-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hud-roster-item form {
    margin: 0;
}

/* Une plaque : le portrait en médaillon, le nom, les points de vie et l'état en mots */
.hud-roster-entry {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 3.6rem;
    padding: 0.45rem 0.7rem 0.45rem 0.45rem;
    font: inherit;
    text-align: start;
    text-decoration: none;
    color: var(--sand);
    cursor: pointer;
    background: linear-gradient(170deg, #2c231d, #1b1511);
    border: 1px solid rgb(133 89 31 / 70%);
    border-radius: 10px;
    box-shadow: inset 1px 1px 0 rgb(255 238 204 / 8%), inset -1px -2px 0 rgb(0 0 0 / 40%);
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.2s ease;
}

.hud-roster-entry:hover,
.hud-roster-entry:focus-visible {
    color: var(--sand);
    border-color: var(--rarity, #c08a42);
    box-shadow: inset 1px 1px 0 rgb(255 238 204 / 10%), 0 0 14px color-mix(in srgb, var(--rarity, #c08a42) 28%, transparent);
}

.hud-roster-item.is-chosen .hud-roster-entry {
    background: linear-gradient(170deg, #3a2c1d, #221810);
    border-color: #eac373;
    box-shadow: inset 0 0 0 1px rgb(234 195 115 / 25%), inset 1px 1px 0 rgb(255 244 204 / 18%);
}

.hud-roster-medallion {
    flex: none;
    display: block;
    width: 2.7rem;
    height: 2.7rem;
    overflow: hidden;
    border: 2px solid var(--rarity, #c08a42);
    border-radius: 50%;
    background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--rarity, #c08a42) 40%, #1a120c), #0b0806 75%);
    box-shadow: 0 0 0 2px #0e0a08;
}

.hud-roster-medallion img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 0;
    transform: scale(2.5);
    transform-origin: 50% 7%;
}

.hud-roster-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    line-height: 1.2;
}

.hud-roster-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    color: var(--gold);
    white-space: nowrap;
}

.hud-roster-item:not(.is-chosen) .hud-roster-chosen {
    display: none;
}

.hud-roster-chosen {
    padding: 0.05rem 0.4rem;
    font-size: 0.6rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #2e1c08;
    background: linear-gradient(160deg, #f6d998, #c08a42 60%, #a77a2c);
    border-radius: 3px;
    box-shadow: inset 1px 1px 0 rgb(255 244 214 / 50%), 0 1px 2px rgb(0 0 0 / 50%);
}

.hud-roster-state {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem 0.6rem;
    font-size: 0.78rem;
    color: var(--sand-dim);
}

.hud-roster-hp {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #ff9a85;
}

.hud-roster-hp .icon {
    width: 0.9rem;
    height: 0.9rem;
}

.hud-roster-word.tier-2 {
    color: #e8b06a;
}

.hud-roster-word.tier-3,
.hud-roster-word.tier-4 {
    color: #ff8f78;
}

.hud-roster-recruit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 2.8rem;
    margin-top: 0.55rem;
    padding: 0.5rem 0.75rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--gold);
    border-top: 1px solid rgb(192 138 66 / 35%);
}

.hud-roster-recruit .icon {
    width: 1.2rem;
    height: 1.2rem;
}

.hud-roster-recruit:hover,
.hud-roster-recruit:focus-visible {
    color: #fff0c4;
}

@media (max-width: 52rem) {
    .hud-roster {
        right: 0.85rem;
        left: 0.85rem;
        width: auto;
    }

    .hud-roster-count {
        left: 2.05rem;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .hud-roster {
        transition: opacity 0.16s ease, transform 0.16s ease, overlay 0.16s allow-discrete, display 0.16s allow-discrete;
        opacity: 0;
        transform: translateY(-6px);
    }

    .hud-roster:popover-open {
        opacity: 1;
        transform: none;
    }

    @starting-style {
        .hud-roster:popover-open {
            opacity: 0;
            transform: translateY(-6px);
        }
    }
}

/* Le changement de gladiateur hors de l'accueil (D67) : le contenu s'estompe à peine pendant que la page se refait
   (Turbo, fusionnée), puis revient ; jamais de page blanche */
.site-main {
    transition: opacity 0.18s ease;
}

.is-roster-refreshing .site-main {
    opacity: 0.55;
}

@media (prefers-reduced-motion: reduce) {
    .site-main {
        transition: none;
    }
}

/* ---------- Une seule fenêtre de jeu (D67) : le voile de la fenêtre qui n'a plus la main ----------
   Sobre : la page s'assombrit derrière une plaque de bronze sombre, au centre ; rien ne se clique dessous. */
.window-veil {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgb(8 6 4 / 78%);
    backdrop-filter: blur(3px);
}

.window-veil[hidden] {
    display: none;
}

.window-veil-plate {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: min(26rem, 100%);
    padding: 1.6rem 1.5rem 1.4rem;
    text-align: center;
    color: var(--sand);
    background: linear-gradient(170deg, #3a2f27 0%, #251d18 45%, #16110d 100%);
    border: 1px solid #85591f;
    border-radius: 14px;
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / 55%), inset 1px 1px 0 rgb(246 217 152 / 18%), 6px 14px 30px rgb(0 0 0 / 60%);
}

.window-veil-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    color: var(--gold);
}

.window-veil-text {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--sand-dim);
}

.window-veil-button {
    margin-top: 0.4rem;
    padding: 0.6rem 1.4rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #2e1c08;
    cursor: pointer;
    background: linear-gradient(160deg, #f6d998 0%, #c08a42 55%, #85591f 100%);
    border: 1px solid #3f280c;
    border-radius: 999px;
    box-shadow: inset 1px 1px 0 rgb(255 244 214 / 55%), 0 2px 6px rgb(0 0 0 / 55%);
}

.window-veil-button:hover,
.window-veil-button:focus-visible {
    box-shadow: inset 1px 1px 0 rgb(255 244 214 / 60%), 0 0 16px rgb(234 195 115 / 45%), 0 2px 6px rgb(0 0 0 / 55%);
}

/* ---------- Au combat (D71) : visible d'un coup d'œil, sans compte à rebours (D18) ---------- */

/* Le mot : un cartouche rouge bordé de bronze, sous le nom */
.hud-fight {
    align-self: flex-start;
    white-space: nowrap;
    padding: 0.08rem 0.5rem;
    border-radius: 0.25rem;
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    line-height: 1.3;
    text-transform: uppercase;
    color: #fff0d6;
    background: linear-gradient(180deg, #b3301b, #6e150b);
    box-shadow: 0 0 0 1px #c9973f, 0 0 10px rgb(220 70 30 / 45%);
}

/* Le médaillon : un anneau rouge qui bat doucement, comme une braise */
.hud-medallion {
    position: relative;
}

.hud-medallion.is-fighting {
    box-shadow: 0 0 0 2px #c8361d, 0 0 12px rgb(230 80 40 / 70%);
    animation: hud-fight-ring 1.8s ease-in-out infinite;
}

@keyframes hud-fight-ring {
    0%,
    100% {
        box-shadow: 0 0 0 2px #c8361d, 0 0 8px rgb(230 80 40 / 45%);
    }

    50% {
        box-shadow: 0 0 0 3px #e2502c, 0 0 18px rgb(255 110 60 / 80%);
    }
}

/* L'insigne : deux glaives croisés sur un disque de bronze */
.hud-fight-mark {
    position: absolute;
    top: 0.05rem;
    left: 2.35rem;
    display: grid;
    place-items: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 32%, #e7b764, #a8752c 55%, #5e3b12);
    box-shadow: 0 0 0 2px #1a120c, 0 2px 5px rgb(0 0 0 / 60%);
}

.hud-fight-mark .icon {
    width: 0.85rem;
    height: 0.85rem;
    color: #3a1606;
}

.hud-champion.is-fighting {
    position: relative;
    border-color: #a5321c;
}

.hud-champion.is-fighting .hud-champion-stats {
    opacity: 0.75;
}

/* Le sélecteur : la plaque du gladiateur au combat, liserée de rouge qui bat, glaives et état en mots */
.hud-roster-item.is-fighting .hud-roster-entry {
    border-color: #b3301b;
    background: linear-gradient(90deg, rgb(120 24 12 / 45%), transparent 70%);
    animation: hud-fight-plate 1.8s ease-in-out infinite;
}

@keyframes hud-fight-plate {
    0%,
    100% {
        box-shadow: inset 0 0 0 1px rgb(200 54 29 / 70%);
    }

    50% {
        box-shadow: inset 0 0 0 1px #e2502c, 0 0 12px rgb(255 110 60 / 45%);
    }
}

.hud-roster-fight {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0.1rem 0 0.2rem;
    font-family: var(--font-display);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #ffb48f;
}

.hud-roster-fight .icon {
    width: 0.95rem;
    height: 0.95rem;
}

/* Les lieux (D71) : un bandeau sobre sous la barre quand le gladiateur choisi est au combat ; ce qu'on y prépare est
   fait après le combat */
.fight-banner {
    position: fixed;
    top: calc(var(--header-height, 4.6rem) + 0.6rem);
    right: 0.75rem;
    left: 0.75rem;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: fit-content;
    margin: 0 auto;
    padding: 0.45rem 0.55rem 0.45rem 0.8rem;
    border-radius: 999px;
    color: #fff0d6;
    background: linear-gradient(180deg, #8f2414, #5c120a);
    box-shadow: 0 0 0 1px #c9973f, 0 8px 18px rgb(0 0 0 / 55%);
}

.fight-banner > .icon {
    width: 1.15rem;
    height: 1.15rem;
    color: #f0cf86;
}

.fight-banner-text {
    font-size: 0.92rem;
    line-height: 1.25;
}

.fight-banner-link {
    flex: none;
    padding: 0.28rem 0.85rem;
    border-radius: 999px;
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-decoration: none;
    color: #2a1406;
    background: linear-gradient(180deg, #f0cf86, #c99a45 55%, #9a6d26);
}

@media (prefers-reduced-motion: reduce) {
    .hud-medallion.is-fighting,
    .hud-roster-item.is-fighting .hud-roster-entry {
        animation: none;
    }
}

@media (max-width: 40rem) {
    /* À droite de la porte de sortie du lieu, qu'il ne couvre pas */
    .fight-banner {
        left: 4.4rem;
        gap: 0.5rem;
        border-radius: 0.6rem;
    }

    .fight-banner-text {
        font-size: 0.82rem;
    }

    .hud-fight {
        padding: 0.05rem 0.35rem;
        font-size: 0.6rem;
        letter-spacing: 0.1em;
    }

    .hud-fight-mark {
        left: 1.95rem;
        width: 1.1rem;
        height: 1.1rem;
    }
}

/* ---------- Le centre d'alertes : la tablette de cire, et ses nouvelles (décision de l'utilisateur, 2026-11-29) ---------- */

.hud-news {
    grid-column: -3;
    position: relative;
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    color: var(--sand-dim);
    cursor: pointer;
    background: rgb(0 0 0 / 35%);
    border: 1px solid rgb(201 151 63 / 35%);
    border-radius: 50%;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.hud-news .icon {
    width: 1.5rem;
    height: 1.5rem;
}

.hud-news:hover,
.hud-news:focus-visible,
.hud-news.has-unread {
    color: var(--gold);
    border-color: var(--bronze);
}

/* Le nombre non lu : un sceau de cire rouge */
.hud-news-count {
    position: absolute;
    top: -0.3rem;
    right: -0.35rem;
    display: grid;
    place-items: center;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    font-family: var(--font-display);
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1;
    color: #fff0d6;
    background: radial-gradient(circle at 40% 32%, #d8482a, #9c2414 60%, #5c120a);
    box-shadow: 0 0 0 2px #120c09, 0 2px 4px rgb(0 0 0 / 55%);
}

.hud-news-panel {
    position: fixed;
    inset: auto;
    top: calc(var(--hud-h) + 0.4rem);
    right: clamp(1rem, 3vw, 2rem);
    width: min(25rem, calc(100vw - 2rem));
    max-height: min(34rem, calc(100dvh - var(--hud-h) - 1rem));
    margin: 0;
    padding: 0;
    overflow: hidden auto;
    color: var(--sand);
    background: linear-gradient(180deg, #2a1e16, #150f0b);
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgb(243 211 138 / 12%), var(--shadow-deep);
}

.hud-news-panel:popover-open {
    display: flex;
    flex-direction: column;
}

.hud-news-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0.6rem 0.65rem 0.9rem;
    background: linear-gradient(180deg, #2c2018, #241a13);
    border-bottom: 1px solid var(--line);
}

.hud-news-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold);
}

.hud-news-title .icon {
    width: 1.15rem;
    height: 1.15rem;
}

.hud-news-close {
    position: relative;
    width: 2rem;
    height: 2rem;
    padding: 0;
    cursor: pointer;
    background: transparent;
    border: 1px solid rgb(201 151 63 / 30%);
    border-radius: 50%;
}

.hud-news-close::before,
.hud-news-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.85rem;
    height: 2px;
    background: var(--sand-dim);
    border-radius: 1px;
    transform: translate(-50%, -50%) rotate(45deg);
}

.hud-news-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.hud-news-empty {
    margin: 0;
    padding: 1.4rem 1rem;
    font-style: italic;
    text-align: center;
    color: var(--sand-dim);
}

.hud-news-list {
    margin: 0;
    padding: 0.3rem;
    list-style: none;
}

.hud-news-link {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.15rem 0.7rem;
    padding: 0.6rem 0.65rem;
    color: inherit;
    text-decoration: none;
    border-radius: 10px;
}

a.hud-news-link:hover,
a.hud-news-link:focus-visible {
    background: rgb(201 151 63 / 10%);
}

.hud-news-icon {
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    color: var(--gold);
    background: rgb(0 0 0 / 35%);
    border: 1px solid rgb(201 151 63 / 30%);
    border-radius: 50%;
}

.hud-news-icon .icon {
    width: 1.15rem;
    height: 1.15rem;
}

.hud-news-text {
    font-size: 0.92rem;
    line-height: 1.35;
}

.hud-news-time {
    font-size: 0.74rem;
    color: var(--sand-dim);
}

/* Non lue : un liseré d'or à gauche et le texte plus clair */
.hud-news-item.is-unread .hud-news-link {
    background: linear-gradient(90deg, rgb(201 151 63 / 14%), transparent 65%);
    box-shadow: inset 3px 0 0 var(--gold);
}

.hud-news-item.is-unread .hud-news-text {
    color: #fbefd8;
}

.news-death .hud-news-icon,
.news-stafffled .hud-news-icon,
.news-traderefused .hud-news-icon,
.news-ordercancelled .hud-news-icon {
    color: #ff9a85;
    border-color: rgb(200 54 29 / 50%);
}

/* Téléphone : le panneau couvre l'écran sous la barre */
@media (max-width: 40rem) {
    .hud {
        gap: 0 0.45rem;
    }

    .hud-news {
        width: 2.4rem;
        height: 2.4rem;
    }

    .hud-news-panel {
        inset: var(--hud-h) 0 0;
        width: 100vw;
        max-width: none;
        height: calc(100dvh - var(--hud-h));
        max-height: none;
        border-radius: 0;
    }

    .hud-news-text {
        font-size: 0.95rem;
    }
}

.fight-banner-orders {
    color: #f0cf86;
    white-space: nowrap;
}

/* La fin d'un combat (D71) : un seul toast, qui mène à son écran de fin */
.flash-combat .flash-link {
    color: inherit;
    text-decoration: none;
}

.flash-combat .flash-link:hover,
.flash-combat .flash-link:focus-visible {
    text-decoration: underline;
    text-underline-offset: 0.15em;
}
