/* OCEARA ROGUE */

:root {
    --bg: #02070d;
    --glass: rgba(6, 18, 30, 0.66);
    --glass-strong: rgba(6, 16, 28, 0.88);
    --stroke: rgba(150, 215, 255, 0.12);
    --stroke-strong: rgba(150, 215, 255, 0.26);
    --text: #eaf7ff;
    --muted: rgba(205, 228, 244, 0.66);
    --faint: rgba(205, 228, 244, 0.4);
    --accent: #5fd4ff;
    --accent-rgb: 95, 212, 255;
    --heart: #ff4d6d;
    --xp: #6dffb0;
    --common: #9fd8ff;
    --rare: #b98cff;
    --epic: #ffc94d;
    --legendary: #ff8a3d;
    --evolution: #7ff0ff;
    --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    /* Pas de texte grossi par le navigateur (iPhone à l'horizontale, réglages d'Android) : les tailles sont les nôtres */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    user-select: none;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

button:focus-visible {
    outline: 2px solid rgba(var(--accent-rgb), 0.8);
    outline-offset: 3px;
}

kbd {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 5px;
    border: 1px solid var(--stroke-strong);
    background: rgba(255, 255, 255, 0.05);
    font-family: inherit;
    font-size: 11px;
    text-align: center;
    color: var(--muted);
}

.hidden {
    display: none !important;
}

#viewport {
    position: fixed;
    inset: 0;
    cursor: crosshair;
}

#viewport canvas {
    display: block;
}

/* ---------- Calques plein écran ---------- */

#float-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.float-text {
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 700;
    font-size: 15px;
    color: #ffffff;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6), 0 0 8px rgba(0, 0, 0, 0.5);
    opacity: 0;
    white-space: nowrap;
    will-change: transform;
}

.float-text.crit {
    font-size: 21px;
    color: #ffd35c;
}

.float-text.hurt {
    font-size: 20px;
    color: var(--heart);
}

/* Dégâts reçus : à la couleur de leur type (data/damage.js, hud.css .kw-*) */
.float-text.hurt.hurt-phys { color: #ff8a66; }
.float-text.hurt.hurt-special { color: #d99bff; }
.float-text.hurt.hurt-true { color: #eef2f8; }

.float-text.heal {
    color: #7dffa8;
}

.float-text.perfect {
    font-size: 18px;
    color: #bff4ff;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-shadow: 0 0 16px rgba(var(--accent-rgb), 0.9);
}

.float-text.info {
    font-size: 14px;
    color: var(--xp);
}

/* Consigne d'une mécanique au-dessus du porteur (Encounter.callout), puis son verdict : les couleurs des bords de
   l'écran (hud.css, #edge-alert) — s'écarter violet, partager or ; emmener au bord rouge (ronces de l'Hydre) */
.float-text.mech {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8), 0 0 10px rgba(0, 0, 0, 0.7);
}
.float-text.mech.spread { color: #d0a4ff; }
.float-text.mech.share { color: #ffd66b; }
.float-text.mech.edge { color: #ff7088; }
.float-text.mech.path { color: #8ff0a8; }
.float-text.mech.ok { color: #6dffb0; font-size: 22px; }
.float-text.mech.fail { color: #ff9a9a; font-size: 16px; }

/* Pseudos au-dessus des créatures, en groupe (nametags.js) : sous les chiffres de dégâts */
#name-tags {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.name-tag {
    --f: #5fd4ff;
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    will-change: transform;
}

.name-tag.below {
    flex-direction: column-reverse;
}

.nt-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 8px;
    border-radius: 99px;
    background: rgba(4, 12, 22, 0.82);
    box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--f) 85%, transparent) inset, 0 4px 14px rgba(0, 0, 0, 0.55);
    white-space: nowrap;
}

.nt-pill i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--f);
    box-shadow: 0 0 8px var(--f);
}

.nt-pill b {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.nt-pill span {
    font-size: 11px;
    font-weight: 600;
    color: var(--f);
}

/* Bot : pas de seconde ligne (nametags.js) */
.nt-pill span:empty {
    display: none;
}

.name-tag.downed .nt-pill span {
    color: #ff7a7a;
}

.nt-stem {
    width: 2px;
    height: 16px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--f) 90%, transparent), transparent);
}

.name-tag.below .nt-stem {
    background: linear-gradient(0deg, color-mix(in srgb, var(--f) 90%, transparent), transparent);
}

@media (max-width: 560px) {
    .nt-pill {
        gap: 5px;
        padding: 2px 8px 2px 6px;
    }

    .nt-pill b {
        font-size: 11.5px;
    }

    .nt-pill span {
        font-size: 10px;
    }

    .nt-stem {
        height: 11px;
    }
}

#vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

#vignette.low {
    animation: lowhp 1s ease-in-out infinite;
}

#hurt {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 40, 70, 0.55) 100%);
}

#hurt.go {
    animation: hurt 0.45s ease-out forwards;
}

#flash {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(circle at 50% 50%, #ffffff 0%, rgba(var(--accent-rgb), 0.55) 35%, transparent 75%);
}

#flash.go {
    animation: hurt 0.8s ease-out forwards;
}

#fade {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: var(--bg);
    opacity: 1;
    transition: opacity 0.45s ease;
}

/* ---------- HUD ---------- */

#hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.hud-top {
    position: absolute;
    top: 18px;
    left: 20px;
    right: 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 16px;
}

.hud-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

#hearts {
    display: flex;
    gap: 4px;
}

.heart {
    width: 22px;
    height: 20px;
    background: var(--heart);
    clip-path: path('M11 19 C 4 13, 0 10, 0 5.5 C 0 2.5, 2.5 0, 5.5 0 C 7.8 0, 9.8 1.4, 11 3.2 C 12.2 1.4, 14.2 0, 16.5 0 C 19.5 0, 22 2.5, 22 5.5 C 22 10, 18 13, 11 19 Z');
    filter: drop-shadow(0 0 6px rgba(255, 77, 109, 0.6));
    transition: transform 0.2s, opacity 0.2s, background 0.2s;
}

.heart.empty {
    background: rgba(255, 255, 255, 0.14);
    filter: none;
}

.heart.pop {
    animation: heartpop 0.35s ease;
}

.level-chip {
    padding: 4px 10px;
    border-radius: 99px;
    background: var(--glass);
    border: 1px solid var(--stroke);
    font-size: 12.5px;
    color: var(--muted);
    backdrop-filter: blur(10px);
}

.level-chip b {
    color: var(--xp);
    font-size: 14px;
}

.hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 280px;
}

.zone {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

.zone-sub {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--muted);
}

.zone-timer {
    font-size: 30px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}

.zone-terrain {
    max-width: 380px;
    margin-top: 2px;
    padding: 3px 11px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 700;
    text-align: center;
    color: #ffd98a;
    background: rgba(255, 196, 90, 0.12);
    border: 1px solid rgba(255, 196, 90, 0.35);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.zone-terrain span {
    font-weight: 500;
    color: var(--muted);
}

.zone-timer.portal {
    font-size: 18px;
    color: rgb(var(--accent-rgb));
    animation: pulse 1.2s ease-in-out infinite;
}

#boss-bar {
    width: min(460px, 60vw);
    margin-top: 4px;
}

.boss-name {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #ffb3c0;
    margin-bottom: 4px;
}

.boss-track {
    height: 10px;
    border-radius: 99px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 90, 120, 0.35);
    overflow: hidden;
}

.boss-track i {
    display: block;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff3355, #ff8a5c);
    box-shadow: 0 0 12px rgba(255, 51, 85, 0.8);
    transition: width 0.15s ease;
}

#boss-bar.enraged .boss-track i {
    background: linear-gradient(90deg, #ff1f3d, #ffcc4d);
    animation: pulse 0.6s ease-in-out infinite;
}

.hud-right {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 11px;
    color: var(--faint);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.stat b {
    font-size: 18px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

#xp-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: rgba(0, 0, 0, 0.45);
}

#xp-bar i {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #3dd6a0, var(--xp));
    box-shadow: 0 0 10px rgba(109, 255, 176, 0.7);
    transition: width 0.15s ease;
}

.hud-bottom {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 18px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    gap: 16px;
}

#build {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-width: 360px;
}

.build-icon {
    position: relative;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--glass);
    border: 1px solid var(--stroke);
    font-size: 15px;
    backdrop-filter: blur(10px);
}

.build-icon.rare { border-color: rgba(185, 140, 255, 0.5); }
.build-icon.epic { border-color: rgba(255, 201, 77, 0.55); }
.build-icon.legendary { border-color: rgba(255, 138, 61, 0.9); box-shadow: 0 0 12px -2px rgba(255, 138, 61, 0.8); }
.build-icon.evolution { border-color: rgba(127, 240, 255, 0.9); box-shadow: 0 0 12px -2px rgba(127, 240, 255, 0.8); color: var(--evolution); }

.build-icon b {
    position: absolute;
    right: -4px;
    bottom: -4px;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 99px;
    background: #0b1a28;
    border: 1px solid var(--stroke-strong);
    font-size: 9.5px;
    line-height: 13px;
    text-align: center;
}

/* Boutons de compétence : l'anneau suit la recharge, un voile tourne dessus et les secondes restantes
   s'affichent au centre ; une onde marque le retour, pour le voir sans quitter le combat des yeux */
.abilities {
    display: flex;
    align-items: end;
    gap: 16px;
}

.ability {
    --size: 72px;
    position: relative;
    width: var(--size);
    height: var(--size);
    display: grid;
    place-items: center;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 28%, rgba(var(--accent-rgb), 0.16), transparent 68%),
        var(--glass-strong);
    border: 1px solid var(--stroke-strong);
    backdrop-filter: blur(10px);
    transition: border-color 0.15s, box-shadow 0.2s;
}

.ability-main {
    --size: 86px;
}

.ability-small {
    --size: 50px;
}

.ab-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: conic-gradient(rgba(var(--accent-rgb), 0.95) calc(var(--p, 1) * 360deg), rgba(255, 255, 255, 0.08) 0);
    -webkit-mask: radial-gradient(circle, transparent calc(var(--size) / 2 + 1px), #000 calc(var(--size) / 2 + 2px));
    mask: radial-gradient(circle, transparent calc(var(--size) / 2 + 1px), #000 calc(var(--size) / 2 + 2px));
}

.ab-icon {
    position: relative;
    font-size: calc(var(--size) * 0.4);
    font-weight: 700;
    line-height: 1;
    color: rgb(var(--accent-rgb));
    text-shadow: 0 0 12px rgba(var(--accent-rgb), 0.45);
    transition: opacity 0.15s, filter 0.15s;
}

/* Voile de recharge : la part qui reste à recharger, retirée dans le sens horaire */
.ab-sweep {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(transparent calc(var(--p, 1) * 360deg), rgba(2, 7, 13, 0.66) 0);
    opacity: 0;
    transition: opacity 0.12s;
    pointer-events: none;
}

.ab-cd {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: calc(var(--size) * 0.34);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95), 0 0 12px rgba(0, 0, 0, 0.7);
    pointer-events: none;
}

.ability.cooling {
    border-color: var(--stroke);
}

.ability.cooling .ab-sweep {
    opacity: 1;
}

.ability.cooling .ab-icon {
    opacity: 0.35;
    filter: saturate(0.25);
}

.ability.ready {
    border-color: rgba(var(--accent-rgb), 0.6);
    box-shadow: 0 0 24px -6px rgba(var(--accent-rgb), 0.9), inset 0 0 16px -6px rgba(var(--accent-rgb), 0.7);
}

.ability.casting {
    border-color: rgba(255, 220, 140, 0.9);
    box-shadow: 0 0 20px rgba(255, 210, 120, 0.55);
}

/* L'incantation remplit l'anneau en doré */
.ability.casting .ab-ring {
    background: conic-gradient(rgba(255, 214, 120, 0.95) calc(var(--p, 1) * 360deg), rgba(255, 255, 255, 0.08) 0);
}

.ability.casting .ab-icon {
    animation: pulse 0.35s ease-in-out infinite;
}

/* Retour de recharge : une onde part du bouton et l'icône rebondit */
.ability.back::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgb(var(--accent-rgb));
    box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.9);
    animation: ab-back 0.6s ease-out forwards;
    pointer-events: none;
}

.ability.back .ab-icon {
    animation: ab-pop 0.4s ease-out;
}

@keyframes ab-back {
    from { transform: scale(0.92); opacity: 1; }
    to { transform: scale(1.5); opacity: 0; }
}

@keyframes ab-pop {
    40% { transform: scale(1.3); }
}

.ability kbd {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 7px;
    font-size: 11.5px;
    color: var(--text);
    background: #081420;
    border-color: rgba(var(--accent-rgb), 0.28);
    white-space: nowrap;
}

.ability small {
    position: absolute;
    top: -18px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--muted);
    white-space: nowrap;
}

/* Tir automatique : allumé en Auto, éteint en Clic */
.ability-small.on {
    border-color: rgba(var(--accent-rgb), 0.45);
}

.ability-small.on small {
    color: rgb(var(--accent-rgb));
}

.ability-small:not(.on) .ab-icon {
    opacity: 0.4;
    filter: saturate(0.25);
}

.ab-pips {
    position: absolute;
    top: -16px;
    display: flex;
    gap: 4px;
}

.ab-pips i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.ab-pips i.on {
    background: rgb(var(--accent-rgb));
    border-color: transparent;
    box-shadow: 0 0 7px rgb(var(--accent-rgb));
}

@media (prefers-reduced-motion: reduce) {
    .ability.back::after,
    .ability.back .ab-icon {
        animation: none;
    }
}

.hud-hint {
    justify-self: end;
    font-size: 11.5px;
    color: var(--faint);
}

#banner {
    position: absolute;
    top: 22%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    opacity: 0;
    pointer-events: none;
}

#banner.show {
    animation: banner 2.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.banner-kicker {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: rgb(var(--accent-rgb));
}

.banner-title {
    font-size: 42px;
    font-weight: 800;
    line-height: 1.1;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.7), 0 0 30px rgba(var(--accent-rgb), 0.35);
}

#banner.danger .banner-kicker { color: #ff6b83; }
#banner.danger .banner-title { text-shadow: 0 4px 30px rgba(0, 0, 0, 0.7), 0 0 30px rgba(255, 51, 85, 0.5); }

/* Entrée d'un boss : bandes de cinéma (sous le HUD) et carte-titre, à la couleur de son aura (--boss-rgb) */
#letterbox {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

#letterbox i {
    position: absolute;
    left: 0;
    right: 0;
    height: 8vh;
    background: #000;
    transform: scaleY(0);
    transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#letterbox i:first-child { top: 0; transform-origin: top; }
#letterbox i:last-child { bottom: 0; transform-origin: bottom; }
#letterbox.on i { transform: scaleY(1); }

#boss-card {
    --boss-rgb: 176, 107, 255;
    position: absolute;
    bottom: 17%;
    left: 50%;
    width: min(92vw, 760px);
    transform: translateX(-50%);
    text-align: center;
    opacity: 0;
    pointer-events: none;
}

#boss-card.show {
    animation: boss-card 3.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Voile sombre derrière la carte : lisible même sur des gemmes ou des effets brillants */
#boss-card::before {
    content: '';
    position: absolute;
    inset: -18px -12%;
    z-index: -1;
    background: radial-gradient(ellipse at center, rgba(4, 3, 10, 0.55), rgba(4, 3, 10, 0.3) 45%, transparent 72%);
}

.bc-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.45em;
    text-transform: uppercase;
    color: rgb(var(--boss-rgb));
    text-shadow: 0 0 18px rgba(var(--boss-rgb), 0.6);
}

.bc-title {
    margin-top: 6px;
    font-size: clamp(34px, 7vw, 60px);
    font-weight: 800;
    line-height: 1.05;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.75), 0 0 36px rgba(var(--boss-rgb), 0.55);
}

.bc-look {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.9);
}

.bc-look::before,
.bc-look::after {
    content: '';
    width: 42px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgb(var(--boss-rgb)));
}

.bc-look::after { transform: scaleX(-1); }
.bc-look:empty { display: none; }

.bc-hint {
    margin-top: 10px;
    font-size: 13px;
    color: var(--muted);
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}

@keyframes boss-card {
    0% { opacity: 0; transform: translate(-50%, 14px) scale(1.08); filter: blur(6px); }
    14% { opacity: 1; transform: translate(-50%, 0) scale(1); filter: blur(0); }
    82% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -10px) scale(0.98); }
}

#loading-chip {
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    padding: 7px 14px;
    border-radius: 99px;
    background: var(--glass);
    border: 1px solid var(--stroke);
    font-size: 12.5px;
    color: var(--muted);
    animation: pulse 1s ease-in-out infinite;
}

/* ---------- Écrans ---------- */

.screen {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: radial-gradient(ellipse at 50% 40%, rgba(4, 20, 34, 0.62), rgba(1, 5, 10, 0.88));
    z-index: 5;
}

#screen-title {
    background: radial-gradient(ellipse at 50% 30%, rgba(8, 36, 56, 0.35), rgba(1, 5, 10, 0.75));
    backdrop-filter: none;
}

.title-card {
    width: min(560px, 100%);
    text-align: center;
}

.title-kicker {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--faint);
}

.title-card h1 {
    font-size: clamp(48px, 9vw, 78px);
    font-weight: 800;
    line-height: 1;
    margin: 8px 0 14px;
    background: linear-gradient(120deg, #5fd4ff, #a3ff5c 55%, #c58bff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 6px 30px rgba(95, 212, 255, 0.25));
}

.title-card h1 span {
    font-weight: 400;
}

.title-pitch {
    font-size: 16px;
    line-height: 1.55;
    color: var(--muted);
    max-width: 460px;
    margin: 0 auto;
}

.c1 { color: #5fd4ff; }
.c3 { color: #c58bff; }

.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 24px 0 14px;
    text-align: left;
}

.controls > div {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--glass);
    border: 1px solid var(--stroke);
    font-size: 13px;
}

.controls span {
    margin-left: 4px;
    color: var(--muted);
}

.tip {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px dashed rgba(var(--accent-rgb), 0.35);
    margin-bottom: 22px;
}

.tip b {
    color: rgb(var(--accent-rgb));
}

.btn-primary {
    position: relative;
    overflow: hidden;
    min-width: 220px;
    padding: 15px 34px;
    border-radius: 999px;
    background: rgb(var(--accent-rgb));
    color: #04121c;
    font-size: 17px;
    font-weight: 700;
    box-shadow: 0 10px 34px -10px rgba(var(--accent-rgb), 0.9);
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 40px -10px rgba(var(--accent-rgb), 1);
}

.btn-primary:disabled {
    cursor: default;
    background: rgba(var(--accent-rgb), 0.25);
    color: var(--text);
    box-shadow: none;
}

.btn-primary span {
    position: relative;
    z-index: 1;
}

#play-progress {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: rgba(var(--accent-rgb), 0.45);
    transition: width 0.25s ease;
}

.btn-primary:not(:disabled) #play-progress {
    display: none;
}

.btn-ghost {
    padding: 13px 26px;
    border-radius: 999px;
    border: 1px solid var(--stroke-strong);
    color: var(--muted);
    font-weight: 600;
}

.btn-ghost:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.best {
    margin-top: 14px;
    font-size: 12.5px;
    color: var(--faint);
    min-height: 18px;
}

/* Montée de niveau */

.levelup {
    width: min(900px, 100%);
    text-align: center;
}

.levelup-kicker {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--xp);
}

.levelup h2 {
    font-size: 32px;
    font-weight: 700;
    margin: 4px 0 22px;
}

#cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.card {
    --r: var(--common);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 26px 18px 20px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)), var(--glass-strong);
    border: 1px solid color-mix(in srgb, var(--r) 40%, transparent);
    text-align: center;
    opacity: 0;
    transform: translateY(16px);
    animation: cardin 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.12s; }

.card:hover,
.card:focus-visible {
    transform: translateY(-4px);
    border-color: var(--r);
    box-shadow: 0 16px 40px -18px var(--r);
}

.card.rare { --r: var(--rare); }
.card.epic { --r: var(--epic); }
.card.legendary {
    --r: var(--legendary);
    border-width: 2px;
    box-shadow: 0 0 34px -8px var(--legendary), inset 0 0 26px -12px var(--legendary);
    animation: cardin 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards, legendary-glow 1.8s ease-in-out 0.4s infinite;
}

@keyframes legendary-glow {
    0%, 100% { box-shadow: 0 0 30px -10px var(--legendary), inset 0 0 22px -12px var(--legendary); }
    50% { box-shadow: 0 0 46px -6px var(--legendary), inset 0 0 30px -10px var(--legendary); }
}

/* Évolution : fusion de deux cartes, reflets prismatiques */
.card.evolution {
    --r: var(--evolution);
    border-width: 2px;
    background:
        linear-gradient(135deg, rgba(127, 240, 255, 0.12), rgba(185, 140, 255, 0.1) 45%, rgba(255, 201, 77, 0.08)),
        var(--glass-strong);
    box-shadow: 0 0 34px -8px var(--evolution), inset 0 0 26px -12px var(--evolution);
    animation: cardin 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards, evolution-glow 2.2s ease-in-out 0.4s infinite;
}

@keyframes evolution-glow {
    0%, 100% { box-shadow: 0 0 30px -10px var(--evolution), inset 0 0 22px -12px var(--evolution); }
    50% { box-shadow: 0 0 48px -6px #b98cff, inset 0 0 30px -10px var(--evolution); }
}

/* Synergie proposée : ce qu'elle réunit */
.card-evo {
    display: block;
    margin-top: 8px;
    font-style: normal;
    font-size: 11px;
    line-height: 1.4;
    color: var(--evolution);
    opacity: 0.9;
}

/* Synergies où entre la carte proposée : une ligne courte chacune (le détail au survol) ; au menu pause, sur la carte
   survolée, leur recette. Tout ce qui touche aux synergies est en cyan (--evolution) */
.card-synergy {
    display: block;
    margin-top: 6px;
    font-family: var(--font);
    font-style: normal;
    font-size: 11px;
    line-height: 1.35;
    color: var(--evolution);
    cursor: help;
}
.card-synergy b { font-weight: 700; }
.pause-card .card-synergy { margin-top: 4px; cursor: default; }
.pause-card .card-synergy .evo-recipe { justify-content: flex-start; }

/* « Prête » : une étiquette pleine, la couleur des synergies */
.syn-ready,
.evo-status em.syn-ready,
.evo-tally .syn-ready {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--evolution);
    color: #04121a;
    font-style: normal;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.card-rarity {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--r);
}

.card-icon {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    font-size: 32px;
    color: var(--r);
    background: color-mix(in srgb, var(--r) 14%, transparent);
    margin: 4px 0;
}

.card-name {
    font-size: 19px;
    font-weight: 700;
}

.card-desc {
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--muted);
}

.card-level {
    font-size: 11.5px;
    color: var(--faint);
}

/* Carte interprétée par l'attaque de lignée (styles.js) */
.card-tag {
    display: block;
    margin-top: 8px;
    font-style: normal;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--r);
}

/* Bonus de terrain d'un style sur une route */
.card-terrain {
    display: block;
    margin-top: 10px;
    padding: 7px 10px;
    border-radius: 10px;
    font-style: normal;
    font-size: 12px;
    font-weight: 700;
    color: #cfe3ff;
    background: rgba(140, 190, 255, 0.08);
    border: 1px solid rgba(140, 190, 255, 0.28);
}

.card-terrain.mine {
    color: #ffd98a;
    background: rgba(255, 196, 90, 0.1);
    border-color: rgba(255, 196, 90, 0.38);
}

.card-terrain small {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--muted);
}

.card.favored {
    box-shadow: 0 0 0 1px rgba(255, 196, 90, 0.4), 0 18px 40px -22px rgba(255, 196, 90, 0.75);
}

/* Carte de style (STYLE_CARDS) : propre au style d'attaque, icône de l'attaque dans le coin */
.card.style-card {
    background:
        radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--r) 12%, transparent), transparent 70%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)), var(--glass-strong);
}

.card-style {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    font-style: normal;
    font-size: 14px;
    color: var(--r);
    background: color-mix(in srgb, var(--r) 16%, transparent);
    border: 1px solid color-mix(in srgb, var(--r) 45%, transparent);
}

.card kbd {
    position: absolute;
    top: 12px;
    left: 12px;
}

.levelup-hint {
    margin-top: 16px;
    font-size: 12px;
    color: var(--faint);
}

/* Pause & fin */

.panel-card {
    width: min(460px, 100%);
    padding: 30px;
    border-radius: 22px;
    background: var(--glass-strong);
    border: 1px solid var(--stroke);
    text-align: center;
}

.panel-card h2 {
    font-size: 34px;
    font-weight: 800;
    margin-bottom: 18px;
}

.buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.buttons .btn-primary {
    min-width: 0;
}

/* ---------- Page Partie (ui.js renderBuildView) ----------
   Menu pause (onglet Partie), « Mon build » au choix d'une carte, attente des autres en équipe : onglets des joueurs,
   fiche en expédition, cartes et zoom à gauche, synergies (une ligne chacune, l'effet dans le zoom) à droite. Tient sans
   défiler à 1536 × 730. Avant (2026-09-29) : une colonne de 560 px qui défilait. Habillage : hud.css */
.build-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    text-align: left;
}

/* L'altitude et les affixes de l'expédition, en tête : sur téléphone seulement, qui les retire du HUD (ailleurs, le HUD
   les garde sous la barre de vie) */
.bv-affixes {
    display: none;
}

html.phone .bv-affixes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.bv-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.bv-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 214, 140, 0.18);
    background: rgba(10, 16, 30, 0.55);
    font: inherit;
    font-size: 12px;
    color: rgba(236, 226, 205, 0.7);
    cursor: pointer;
}
.bv-tab i { width: 8px; height: 8px; border-radius: 50%; background: var(--f, var(--accent)); }
.bv-tab:hover, .bv-tab:focus-visible { color: #f1e3c4; border-color: rgba(255, 214, 140, 0.45); outline: none; }
.bv-tab.active { color: #ffe7b0; border-color: rgba(255, 214, 140, 0.7); background: rgba(255, 196, 90, 0.14); }

/* Fiche en expédition : les chiffres du hub (sheet.js) ; ce qui a changé depuis le départ en cyan, sa valeur de départ
   dessous */
.bv-sheet {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
}
.bv-stat {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    padding: 3px 8px 4px;
    border-radius: 9px;
    border: 1px solid rgba(255, 222, 160, 0.1);
    background: rgba(10, 16, 30, 0.5);
}
.bv-stat small { overflow: hidden; font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); }
.bv-stat b { font-size: 12.5px; line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.bv-stat em { font-size: 9.5px; line-height: 1.2; font-style: normal; white-space: nowrap; color: var(--faint); }
.bv-stat.is-changed { border-color: rgba(127, 240, 255, 0.3); }
.bv-stat.is-changed b { color: var(--evolution); }

.bv-cols {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 18px;
    align-items: start;
}
.bv-side,
.bv-synergies { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.build-view h3 { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }

/* Cartes : les médaillons (hud.css), leurs crans dessous */
.bv-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    justify-items: center;
    gap: 8px 4px;
}
.bv-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
}
.bv-card > b { font-size: 10px; line-height: 1; color: var(--muted); }
.bv-pips { display: flex; gap: 2px; }
.bv-pips i { width: 5px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.16); }
.bv-pips i.on { background: #ffd66b; }
.bv-zoom.pause-card { margin: 2px 0 0; max-width: none; min-height: 92px; }
.bv-zoom .evo-recipe { flex-wrap: wrap; overflow: visible; }
.bv-empty { margin: 0; font-size: 13px; color: var(--faint); }

/* Synergies : ce qu'elles sont en une phrase, un bilan, puis une ligne chacune (icône, nom, recette, état) */
.evo-help {
    margin: 0;
    font-size: 11px;
    line-height: 1.4;
    color: var(--muted);
}

.evo-list { display: flex; flex-direction: column; gap: 2px; }

.evo-row {
    display: grid;
    grid-template-columns: 18px minmax(80px, 118px) minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 3px 8px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    font: inherit;
    font-size: 12px;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

.evo-name { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.evo-status em {
    font-style: normal;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--muted);
}
.evo-recipe { display: flex; flex-wrap: nowrap; align-items: center; gap: 4px; min-width: 0; overflow: hidden; font-size: 10.5px; color: var(--faint); }
.evo-part {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    white-space: nowrap;
}
.evo-part.done { color: var(--evolution); border-color: rgba(127, 240, 255, 0.35); }
.evo-plus { color: var(--faint); }
.evo-steps { display: inline-flex; gap: 2px; }
.evo-steps i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); }
.evo-steps i.on { background: var(--evolution); }
.evo-icon { font-size: 15px; line-height: 1.2; text-align: center; color: var(--faint); }
.evo-row.is-owned { border-color: rgba(127, 240, 255, 0.45); background: rgba(127, 240, 255, 0.07); }
.evo-row.is-owned .evo-icon, .evo-row.is-owned .evo-status em { color: var(--evolution); }
.evo-row.is-ready { border-color: rgba(127, 240, 255, 0.6); box-shadow: 0 0 14px -8px var(--evolution); }
.evo-row.is-started .evo-icon { color: var(--text, #e8eefc); }
.evo-row.is-locked { opacity: 0.6; }
/* Carte survolée : les synergies où elle entre s'éclairent ; synergie survolée : la sienne */
.evo-row.is-linked,
.evo-row:hover,
.evo-row:focus-visible,
.evo-row.on { border-color: rgba(127, 240, 255, 0.55); background: rgba(127, 240, 255, 0.07); opacity: 1; outline: none; }
/* Bilan sous l'explication : prêtes, en cours, obtenues */
.evo-tally { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.evo-tally span:not(.syn-ready) { padding: 1px 7px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.1); font-size: 10px; color: var(--muted); }

/* Choix d'une carte : « Mon build » à la place des cartes, et pendant l'attente des autres en équipe */
#screen-levelup.show-build #cards,
#screen-levelup.show-build .lu-owned,
#screen-levelup.show-build #btn-reroll,
#screen-levelup.build-open .levelup-hint { display: none; }
#lu-build { margin-top: 6px; }
.lu-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.lu-actions .reroll { margin: 0; }
.lu-build-btn { display: flex; align-items: center; gap: 8px; }
.lu-owned button.build-icon { padding: 0; font: inherit; color: inherit; cursor: pointer; }

/* Menu en équipe : la partie continue (sous le titre) */
.pause-note {
    margin: -4px 0 12px;
    font-family: var(--serif);
    font-style: italic;
    font-size: 12.5px;
    text-align: center;
    color: rgba(255, 214, 140, 0.72);
}

/* Étroit (téléphone à l'horizontale) : la recette passe sous le nom ; très étroit, une colonne */
@media (max-width: 900px) {
    .evo-row { grid-template-columns: 18px minmax(0, 1fr) auto; row-gap: 3px; }
    .evo-row .evo-recipe { grid-column: 2 / -1; grid-row: 2; flex-wrap: wrap; }
    .evo-row .evo-status { grid-column: 3; grid-row: 1; }
}

@media (max-width: 760px) {
    .bv-cols { grid-template-columns: minmax(0, 1fr); }
    .bv-sheet { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
}

.end-kicker {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--faint);
}

#screen-end.victory h2 {
    background: linear-gradient(120deg, #5fd4ff, #a3ff5c 55%, #c58bff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.end-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    text-align: left;
}

.end-stats div {
    padding: 9px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 11.5px;
    color: var(--faint);
}

.end-stats b {
    display: block;
    font-size: 20px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 420px) {
    .end-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.end-stats .record b::after {
    content: ' ★';
    color: var(--epic);
    font-size: 14px;
}

/* Évolution */

#evolve-toast {
    position: fixed;
    top: 16%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    opacity: 0;
    pointer-events: none;
    z-index: 4;
}

#evolve-toast.show {
    animation: banner 3.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.evolve-kicker {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.45em;
    text-transform: uppercase;
    color: rgb(var(--accent-rgb));
}

.evolve-name {
    font-size: 58px;
    font-weight: 800;
    line-height: 1.05;
    text-shadow: 0 0 40px rgba(var(--accent-rgb), 0.7);
}

.evolve-perks {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.evolve-perks span {
    padding: 5px 11px;
    border-radius: 99px;
    background: rgba(var(--accent-rgb), 0.16);
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    font-size: 13px;
    font-weight: 600;
    color: rgb(var(--accent-rgb));
}

/* ---------- Animations ---------- */

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes hurt {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes lowhp {
    0%, 100% { box-shadow: inset 0 0 80px rgba(255, 40, 70, 0.25); }
    50% { box-shadow: inset 0 0 140px rgba(255, 40, 70, 0.5); }
}

@keyframes heartpop {
    0% { transform: scale(1); }
    40% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

@keyframes banner {
    0% { opacity: 0; transform: translate(-50%, 14px) scale(0.96); }
    12% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    78% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -10px) scale(1); }
}

@keyframes cardin {
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
    .hud-top { grid-template-columns: 1fr auto; }
    .hud-right { display: none; }
    .hud-center { min-width: 0; }
    .hud-hint, #build { display: none; }
    .hud-bottom { grid-template-columns: 1fr; justify-items: center; }
    #cards { grid-template-columns: 1fr; gap: 10px; }
    /* Carte en largeur : l'icône à gauche, rareté et nom à côté, la description sur toute la largeur
       (en ligne, tout se tassait dans une colonne de quelques mots) */
    .card {
        display: grid;
        grid-template-columns: 46px minmax(0, 1fr);
        column-gap: 12px;
        row-gap: 2px;
        align-items: center;
        padding: 12px 14px;
        text-align: left;
    }
    .card-icon { grid-column: 1; grid-row: 1 / span 2; width: 46px; height: 46px; margin: 0; font-size: 24px; border-radius: 14px; }
    .card-rarity { grid-column: 2; grid-row: 1; font-size: 10px; letter-spacing: 0.14em; }
    .card-name { grid-column: 2; grid-row: 2; font-size: 17px; line-height: 1.2; }
    .card-desc { grid-column: 1 / -1; grid-row: 3; margin-top: 6px; font-size: 13px; line-height: 1.4; }
    .card-level { grid-column: 1 / -1; grid-row: 4; margin-top: 2px; font-size: 11px; }
    .card-evo, .card-tag, .card-terrain { margin-top: 6px; }
    .card kbd { display: none; }
    .card-style { top: 12px; right: 12px; }
    .levelup h2 { font-size: 24px; margin: 2px 0 12px; }
    .levelup-hint { margin-top: 10px; }
    .controls { grid-template-columns: 1fr; }
    .banner-title { font-size: 30px; }
    .evolve-name { font-size: 40px; }
}

/* Téléphone à l'horizontale : trois cartes côte à côte, compactes, pour tenir en hauteur */
@media (max-height: 520px) and (orientation: landscape) {
    #cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
    .card { padding: 12px 10px 10px; gap: 4px; }
    .card-icon { width: 40px; height: 40px; margin: 0; font-size: 20px; border-radius: 12px; }
    .card-name { font-size: 15px; }
    .card-desc { font-size: 12px; line-height: 1.35; }
    .card-evo, .card-tag, .card-terrain { margin-top: 5px; font-size: 10.5px; }
    .card kbd { display: none; }
    .levelup-kicker { font-size: 11px; }
    .levelup h2 { font-size: 22px; margin: 0 0 8px; }
    .levelup-hint { margin-top: 6px; }

    /* Pause : plus large et plus basse, les trois boutons tiennent sur une ligne */
    #screen-pause .panel-card { width: min(1000px, 100%); padding: 14px 22px 16px; }
    #screen-pause h2 { font-size: 24px; margin-bottom: 6px; }
    #screen-pause .buttons { margin-top: 10px; }
    #screen-pause .buttons button { min-width: 0; padding: 10px 22px; }
}

/* Écran (choix, pause…) plus haut que la fenêtre, sur un téléphone à l'horizontale : il défile, sans
   couper le haut (alignement « safe ») */
.screen {
    overflow-y: auto;
    align-items: safe center;
}

/* ---------- Téléphone en portrait : « Tourne ton téléphone » ----------
   Le jeu, menus compris, se joue à l'horizontale : sur un téléphone tenu droit, cet écran recouvre tout (même requête
   que PORTRAIT_PHONE dans shared/fullscreen.js ; une partie seule se met en pause, main.js) */
#rotate-screen {
    display: none;
}

@media (orientation: portrait) and (max-width: 600px) and (pointer: coarse) {
    #rotate-screen {
        position: fixed;
        inset: 0;
        z-index: 1000;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 12px;
        padding: 32px 28px;
        text-align: center;
        color: var(--text);
        background: radial-gradient(ellipse at 50% 32%, #0d2238 0%, #02070d 70%);
    }
}

.rotate-phone {
    width: 92px;
    height: 92px;
    margin-bottom: 6px;
    fill: none;
    stroke: rgb(var(--gold-rgb, 255, 214, 140));
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 14px rgba(var(--gold-rgb, 255, 214, 140), 0.45));
    animation: rotate-phone 2.6s ease-in-out infinite;
}

@keyframes rotate-phone {
    0%, 22% { transform: rotate(0deg); }
    48%, 78% { transform: rotate(-90deg); }
    100% { transform: rotate(0deg); }
}

#rotate-screen h2 {
    margin: 0;
    font-family: var(--display, 'Lilita One', sans-serif);
    font-size: 28px;
    font-weight: 400;
    letter-spacing: 0.01em;
}

#rotate-screen p {
    margin: 0;
    color: rgba(234, 247, 255, 0.72);
}

#rotate-screen .rotate-fullscreen {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

#rotate-screen .rotate-fullscreen[hidden] {
    display: none;
}

#rotate-screen .rotate-fullscreen svg {
    width: 18px;
    height: 18px;
}

@media (prefers-reduced-motion: reduce) {
    .rotate-phone {
        animation: none;
        transform: rotate(-90deg);
    }
}

/* ---------- Menus (mode, lignée, salle en ligne) ---------- */

.title-card {
    width: min(720px, 100%);
}

.menu-step {
    margin-top: 6px;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 26px 0 18px;
}

.mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 22px 14px 18px;
    border-radius: 18px;
    background: var(--glass-strong);
    border: 1px solid var(--stroke);
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.mode-card:hover,
.mode-card:focus-visible {
    transform: translateY(-3px);
    border-color: rgba(var(--accent-rgb), 0.6);
    box-shadow: 0 16px 40px -20px rgba(var(--accent-rgb), 0.9);
}

.mode-icon {
    font-size: 20px;
    letter-spacing: 2px;
    color: rgb(var(--accent-rgb));
}

.mode-card b {
    font-size: 18px;
}

.mode-card small {
    font-size: 12.5px;
    color: var(--muted);
}

.step-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0 14px;
    text-align: left;
}

.step-head h2 {
    font-size: 22px;
    font-weight: 700;
}

.step-mode {
    margin-left: auto;
    font-size: 12px;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.btn-back {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--stroke-strong);
    color: var(--muted);
    font-size: 16px;
}

.btn-back:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

#family-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 8px;
}

.family-tile {
    --f: #5fd4ff;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 11px;
    border-radius: 12px;
    background: var(--glass);
    border: 1px solid var(--stroke);
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}

.family-tile::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--f);
    box-shadow: 0 0 10px var(--f);
    margin-bottom: 4px;
}

.family-tile b {
    font-size: 14.5px;
}

.family-tile small {
    font-size: 11px;
    color: var(--faint);
}

.family-tile:hover {
    background: rgba(255, 255, 255, 0.06);
}

.family-tile.active {
    border-color: var(--f);
    background: color-mix(in srgb, var(--f) 14%, rgba(6, 16, 28, 0.88));
}

.family-detail {
    min-height: 22px;
    margin: 12px 0 14px;
    font-size: 13.5px;
    color: var(--muted);
}

.family-detail b {
    color: var(--text);
}

.name-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--muted);
}

.name-row input,
.join-row input {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--stroke-strong);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    outline: none;
}

.name-row input:focus,
.join-row input:focus {
    border-color: rgba(var(--accent-rgb), 0.7);
}

#online-join {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin: 10px 0;
}

.join-row {
    display: flex;
    gap: 8px;
}

.join-row input {
    width: 120px;
    text-align: center;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    font-weight: 700;
}

.room-code {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 12px;
}

.room-code b {
    display: block;
    font-size: 40px;
    letter-spacing: 0.3em;
    color: rgb(var(--accent-rgb));
    text-shadow: 0 0 24px rgba(var(--accent-rgb), 0.5);
}

#lobby-members {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}

.member {
    --f: #5fd4ff;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--glass);
    border: 1px solid var(--stroke);
    text-align: left;
    font-size: 14px;
}

.member::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--f);
    box-shadow: 0 0 8px var(--f);
}

.member small {
    color: var(--faint);
}

.member .tag {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.member.empty {
    opacity: 0.45;
    border-style: dashed;
}

.member.empty::before {
    background: var(--faint);
    box-shadow: none;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
}

.lobby-wait {
    font-size: 13px;
    color: var(--faint);
    animation: pulse 1.4s ease-in-out infinite;
}

.online-error {
    min-height: 20px;
    margin-top: 10px;
    font-size: 13px;
    color: #ff8a9c;
}

.controls-details {
    margin-top: 22px;
    text-align: left;
    font-size: 13px;
    color: var(--muted);
}

.controls-details summary {
    cursor: pointer;
    text-align: center;
    color: var(--faint);
}

.controls-details .controls {
    margin: 12px 0 10px;
}

.controls-details .tip {
    margin-bottom: 0;
}

/* ---------- HUD équipe ---------- */

.hud-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.hud-me {
    display: flex;
    align-items: center;
    gap: 12px;
}

#team {
    display: grid;
    gap: 5px;
}

.mate {
    --f: #5fd4ff;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 8px;
    border-radius: 10px;
    background: var(--glass);
    border: 1px solid var(--stroke);
    backdrop-filter: blur(10px);
    font-size: 12px;
}

.mate::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--f);
    box-shadow: 0 0 6px var(--f);
}

.mate b {
    font-weight: 600;
    min-width: 64px;
}

.mate .mini-hearts {
    display: flex;
    gap: 2px;
}

.mate .mini-hearts i {
    width: 7px;
    height: 7px;
    border-radius: 2px;
    background: var(--heart);
}

.mate .mini-hearts i.empty {
    background: rgba(255, 255, 255, 0.15);
}

.mate .status {
    font-size: 10.5px;
    color: #ff8a9c;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.mate .status.portal {
    color: rgb(var(--accent-rgb));
}

#downed-hint {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    border-radius: 99px;
    background: rgba(40, 6, 14, 0.75);
    border: 1px solid rgba(255, 90, 120, 0.4);
    color: #ffb3c0;
    font-size: 13px;
    animation: pulse 1.4s ease-in-out infinite;
}

#notice {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 18px;
    border-radius: 12px;
    background: var(--glass-strong);
    border: 1px solid var(--stroke-strong);
    font-size: 13.5px;
    z-index: 8;
}

.levelup-hint.waiting {
    color: rgb(var(--accent-rgb));
    animation: pulse 1.2s ease-in-out infinite;
}

@media (max-width: 760px) {
    .mode-grid { grid-template-columns: 1fr; }
    #team { display: none; }
}
