
/* --- Header --- */
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.5rem;
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-input) 100%);
    border-bottom: 1px solid rgba(var(--gold-rgb),0.15);
    z-index: 10;
    height: 50px;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
/* Style icone carre uniquement quand le bouton etait dans le header.
   Refonte 2026-05-14 : le bouton est maintenant dans le modal Reglages,
   on scope cet override au header pour ne pas casser la version modal
   (qui herite des classes .btn / .btn-ghost). */
.game-header .btn-fullscreen {
    background: rgba(var(--gold-rgb),0.15);
    border: 1px solid rgba(var(--gold-rgb),0.3);
    color: var(--gold);
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
    line-height: 1;
}
.game-header .btn-fullscreen:hover {
    background: rgba(var(--gold-rgb),0.3);
}
.game-header .logo-egg {
    width: 32px;
    height: 32px;
    object-fit: contain;
    margin-right: 6px;
    vertical-align: middle;
    filter: drop-shadow(0 0 4px rgba(var(--gold-rgb),0.4));
}
.game-header .logo {
    font-family: 'MedievalSharp', cursive;
    font-size: 1.4rem;
    color: var(--gold);
}
/* Mini-card invocateur dans le header (avatar + pseudo). Clic -> panel Summoner.
   Refonte 2026-05-14 : a remplace l'ancien bloc .sidebar-summoner. */
.header-summoner-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.8rem;
    padding: 0.3rem 0.7rem 0.3rem 0.35rem;
    background: rgba(var(--gold-rgb), 0.08);
    border: 1px solid rgba(var(--gold-rgb), 0.35);
    border-radius: 999px;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.header-summoner-btn:hover {
    background: rgba(var(--gold-rgb), 0.18);
    border-color: var(--gold);
    box-shadow: 0 2px 10px rgba(var(--gold-rgb), 0.3);
    transform: translateY(-1px);
}
.header-summoner-btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}
.header-summoner-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(var(--black-rgb), 0.45);
    border: 1px solid rgba(var(--gold-rgb), 0.5);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.header-summoner-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}
.header-summoner-letter {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--gold);
    line-height: 1;
}
.header-summoner-name {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.3px;
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.game-header .user-ashes {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-main);
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 600;
    margin-right: 0.8rem;
    padding: 0.2rem 0.55rem;
    background: rgba(40, 22, 16, 0.55);
    border: 1px solid rgba(var(--gold-rgb), 0.45);
    border-radius: 6px;
}
.game-header .user-ashes img {
    width: 18px;
    height: 18px;
    vertical-align: middle;
}
/* Variante "cendre corrompue" : le container garde le look standard (bordure
   or, fond sombre) - seul le sprite de l'icone recoit le filtre violet, pour
   distinguer la monnaie sans casser l'harmonie du header. */
.game-header .user-ashes-corrupted .icon-ashes-corrupted {
    filter: sepia(1) hue-rotate(230deg) saturate(3.2);
}

/* Bulle "Potion de boost de drop active" (feature 2026-05-15).
   A gauche des cendres. Verte pour signaler le boost actif. Click hors combat
   ouvre une modale d'annulation (destruction definitive).
   [hidden] override CSS : l'attribut HTML doit gagner sur display:inline-flex,
   sinon le bouton reste visible meme sans potion active. */
.game-header .header-drop-potion[hidden] { display: none; }
.game-header .header-drop-potion {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    margin-right: 0.6rem;
    background: linear-gradient(135deg, rgba(40, 100, 50, 0.55), rgba(30, 80, 40, 0.45));
    border: 1px solid rgba(120, 230, 130, 0.55);
    border-radius: 6px;
    color: #c8f7c8;
    font-family: 'Oswald', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(120, 230, 130, 0.25);
    transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.game-header .header-drop-potion:hover {
    background: linear-gradient(135deg, rgba(60, 140, 70, 0.7), rgba(40, 100, 50, 0.55));
    border-color: #88f088;
    transform: translateY(-1px);
    box-shadow: 0 0 14px rgba(120, 230, 130, 0.5);
}
/* Etat "aucune potion active" : grise mais cliquable (ouvre la modale). */
.game-header .header-drop-potion.is-empty {
    background: linear-gradient(135deg, rgba(70, 70, 80, 0.45), rgba(50, 50, 60, 0.35));
    border-color: rgba(160, 160, 170, 0.4);
    color: rgba(220, 220, 220, 0.7);
    box-shadow: none;
}
.game-header .header-drop-potion.is-empty .header-drop-potion-icon {
    filter: grayscale(1) brightness(0.85);
    opacity: 0.7;
}
.game-header .header-drop-potion.is-empty:hover {
    background: linear-gradient(135deg, rgba(90, 90, 100, 0.55), rgba(60, 60, 70, 0.45));
    border-color: rgba(200, 200, 210, 0.6);
    box-shadow: 0 0 8px rgba(200, 200, 210, 0.2);
    color: rgba(240, 240, 240, 0.9);
}
.game-header .header-drop-potion-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    vertical-align: middle;
}
.game-header .header-drop-potion-waves {
    letter-spacing: 0.5px;
}
.game-header .header-drop-potion-waves[hidden] { display: none; }
.game-header .header-drop-potion-waves::after {
    content: ' v';
    opacity: 0.7;
    font-size: 0.7em;
    margin-left: 1px;
}
.game-header .btn-logout {
    font-size: 0.75rem;
    padding: 0.3rem 0.8rem;
}

/* --- Layout --- */
.game-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
    width: 220px;
    min-width: 220px;
    background: linear-gradient(180deg, var(--bg-input) 0%, var(--bg-body) 100%);
    border-right: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    /* padding-top: 0 pour que .sidebar-dragon-selector (sticky) soit flush
       au bord superieur, sans empilement de padding au-dessus. */
    padding: 0 0 0.8rem;
    /* overflow-y: scroll (et non auto) : la scrollbar est TOUJOURS visible,
       meme quand le contenu rentre. Combine a scrollbar-gutter: stable, ca
       garantit zero shift horizontal lors d'un pli/depli de groupe. */
    overflow-y: scroll;
    /* overflow-x: hidden : pendant la transition close/open de la sidebar,
       certains enfants (boutons, badges) peuvent depasser brievement la
       largeur reduite et provoquer une scrollbar horizontale. On la masque. */
    overflow-x: hidden;
    scrollbar-gutter: stable;
    /* Transition smooth pour open/close (cf .sidebar.is-hidden). */
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-right-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease;
}
/* Scrollbar custom : large + thumb tres visible (gold opaque) + track ombre.
   `overflow-y: scroll` garantit que la track est toujours rendue ; le thumb
   par defaut occupe toute la hauteur quand le contenu rentre, donc visible
   meme sans scroll necessaire. WebKit + Firefox. */
.sidebar::-webkit-scrollbar {
    width: 10px;
}
.sidebar::-webkit-scrollbar-track {
    background: rgba(var(--black-rgb), 0.45);
    border-left: 1px solid rgba(var(--scrollbar-thumb-rgb), 0.2);
}
.sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(var(--scrollbar-thumb-rgb), 0.75), rgba(var(--scrollbar-thumb-rgb), 0.55));
    border-radius: 5px;
    border: 1px solid rgba(var(--scrollbar-thumb-rgb), 0.85);
    min-height: 40px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(var(--scrollbar-thumb-rgb), 0.95), rgba(var(--scrollbar-thumb-rgb), 0.75));
}
.sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--scrollbar-thumb-rgb), 0.7) rgba(var(--black-rgb), 0.45);
}
.sidebar-dragon-mini {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}
/* Dragon selector */
.sidebar-dragon-selector {
    position: sticky;
    top: 0;
    z-index: 5;
    /* Fond opaque obligatoire pour le sticky : sinon les .sidebar-item qui
       defilent en dessous transparaissent. Reprend le gradient de .sidebar
       (top: var(--bg-input)) pour rester invisible visuellement. */
    background: var(--bg-input);
    margin: 0 0 0.5rem;
    box-shadow: 0 4px 8px rgba(var(--black-rgb), 0.35);
}
.sidebar-dragon-current {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid rgba(var(--gold-rgb), 0.25);
    margin-bottom: 0.5rem;
    position: relative;
    /* Teinte gold subtile par-dessus le bg de la sidebar pour demarquer le
       bloc dragon (sticky) du reste de la nav. */
    background: linear-gradient(180deg, rgba(var(--gold-rgb), 0.08), rgba(var(--gold-rgb), 0.03));
    transition: background 0.15s, border-color 0.15s;
}
.sidebar-dragon-current[role="button"] {
    cursor: pointer;
}
.sidebar-dragon-current[role="button"]:hover {
    background: linear-gradient(180deg, rgba(var(--gold-rgb), 0.18), rgba(var(--gold-rgb), 0.1));
    border-bottom-color: rgba(var(--gold-rgb), 0.6);
}
.sidebar-dragon-current[role="button"]:hover .sidebar-dragon-name {
    color: var(--gold-light, var(--gold));
}
.sidebar-dragon-current[role="button"]:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: -2px;
}
.sidebar-dragon-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.sidebar-dragon-name {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    color: var(--gold);
    font-size: 0.9rem;
}
.sidebar-dragon-level {
    color: var(--text-secondary);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.sidebar-xp {
    margin-top: 0.4rem;
    background: var(--bg-card);
    border-radius: 4px;
    height: 14px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
}
.sidebar-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--stat-blue-dark), var(--stat-blue-light));
    border-radius: 3px;
    transition: width 0.3s;
}
.sidebar-xp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.6rem;
    color: var(--white);
    text-shadow: 0 0 3px var(--black);
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0 0.5rem;
}
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.5rem 0.8rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Oswald', sans-serif;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}
.sidebar-item .icon-btn-sm {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}
.sidebar-dragon-frame {
    display: inline-block;
    width: 40px;
    height: 40px;
    overflow: hidden;
    flex-shrink: 0;
       vertical-align: middle;
    position: relative;
}
.sidebar-dragon-frame > i {
    display: block;
    width: 128px;
    height: 128px;
    background-repeat: no-repeat;
    background-position: 0 0;
    background-size: auto;
    transform-origin: top left;
    transform: scale(0.3125);
   }
.sidebar-item:hover {
    background: rgba(var(--gold-rgb), 0.1);
    color: var(--gold);
}
.sidebar-item.active {
    background: rgba(var(--gold-rgb), 0.15);
    color: var(--gold);
}
.sidebar-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.sidebar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--error);
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    margin-left: auto;
}
/* Pastille onglet (générique) - utilisée par les onglets Sanctuaire (nid,
   maîtrise, breeding, ascension) et Fabrication (forge, alchimie). Pilotée
   par window.Notifications.setBadge(). */
.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    margin-left: 6px;
    border-radius: 8px;
    background: var(--error);
    color: white;
    font-size: 0.6rem;
    font-weight: bold;
    line-height: 1;
    vertical-align: middle;
}
/* Pastille d'item (carte sanctuaire, ligne d'invitation, slot d'enclos…)
   togglée par window.Notifications via la classe `.has-pastille`. Le pseudo-
   element ::after dessine un petit dot rouge en haut-droite de l'élément. */
.has-pastille {
    position: relative;
}
.has-pastille::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--error);
    box-shadow: 0 0 0 2px var(--bg-body), 0 0 6px rgba(var(--error-rgb), 0.6);
    pointer-events: none;
    z-index: 5;
    animation: pastilleAppear 0.35s ease-out;
}
@keyframes pastilleAppear {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.sidebar-combat-btn {
    background: rgba(200, 50, 50, 0.2);
    color: var(--error-warm);
    border: 1px solid var(--error-warm);
    animation: combatPulse 2s infinite;
    /* Le wrapper .sidebar-dragon-selector (parent) est deja sticky top: 0.
       Le bouton est inclus dedans et scrolle avec - donc 100% fixe au top
       quand le user scrolle, pas de slide individuel. */
}
@keyframes combatPulse {
    0%, 100% { box-shadow: 0 0 5px rgba(255, 102, 68, 0.3); }
    50% { box-shadow: 0 0 15px rgba(255, 102, 68, 0.6); }
}
.sidebar-separator {
    padding: 0.5rem 0.8rem 0.2rem;
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Oswald', sans-serif;
}

/* ============================================
   Sidebar groups (dossiers depliables)
   ============================================ */
.sidebar-group {
    display: flex;
    flex-direction: column;
}
.sidebar-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.8rem 0.3rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: 'Oswald', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.sidebar-group-header:hover {
    color: var(--gold);
    background: rgba(var(--gold-rgb), 0.06);
}
.sidebar-group-chev {
    font-size: 0.85rem;
    color: rgba(var(--gold-rgb), 0.7);
    transition: transform 0.2s ease;
    line-height: 1;
}
.sidebar-group-header[aria-expanded="false"] .sidebar-group-chev {
    transform: rotate(-90deg);
}
.sidebar-group-items {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 999px;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    opacity: 1;
}
.sidebar-group.is-collapsed .sidebar-group-items {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   Sidebar collapse buttons (fermer / re-ouvrir)
   ============================================ */
/* Bouton "Fermer la sidebar" : positionne en fixed JUSTE A DROITE de la
   sidebar (left: largeur sidebar). S'efface auto quand .sidebar est .is-hidden. */
.sidebar-close-btn {
    position: fixed;
    top: 70px;
    left: 220px; /* = largeur .sidebar */
    z-index: 100;
    width: 28px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--black-rgb), 0.75);
    color: var(--gold);
    border: 1px solid rgba(var(--gold-rgb), 0.5);
    border-left: none;
    border-radius: 0 8px 8px 0;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 2px 2px 8px rgba(var(--black-rgb), 0.4);
    transition: background 0.15s, color 0.15s, border-color 0.15s, left 0.2s, transform 0.15s;
}
.sidebar-close-btn:hover {
    background: rgba(var(--gold-rgb), 0.2);
    color: var(--gold-light, var(--gold));
    border-color: var(--gold);
    transform: translateX(2px);
}
/* Sidebar fermee : largeur 0 + overflow hidden. Le contenu disparait
   visuellement mais reste dans le DOM (les hooks JS continuent de marcher). */
.sidebar.is-hidden {
    width: 0;
    min-width: 0;
    padding: 0;
    border-right-width: 0;
    overflow: hidden;
}
/* Quand la sidebar est cachee, le bouton "Fermer" l'est aussi (le bouton
   "Re-ouvrir" prend le relais avec le chevron inverse). */
.sidebar.is-hidden ~ .sidebar-close-btn,
body:has(.sidebar.is-hidden) .sidebar-close-btn {
    display: none;
}
.sidebar-reopen-btn {
    position: fixed;
    top: 70px;
    left: 0;
    z-index: 100;
    width: 28px;
    height: 44px;
    padding: 0;
    background: rgba(var(--black-rgb), 0.75);
    color: var(--gold);
    border: 1px solid rgba(var(--gold-rgb), 0.5);
    border-left: none;
    border-radius: 0 8px 8px 0;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 2px 2px 8px rgba(var(--black-rgb), 0.4);
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}
.sidebar-reopen-btn:hover {
    background: rgba(var(--gold-rgb), 0.2);
    color: var(--gold-light, var(--gold));
    border-color: var(--gold);
    transform: translateX(2px);
}

/* --- Main Content --- */
.game-main {
    flex: 1;
    overflow-y: scroll;
    padding: 1.5rem;
    background: var(--bg-body);
}
.panel {
    display: none;
    opacity: 0;
    transform: translateY(12px);
}
.panel.active {
    display: block;
    overflow: visible;
    transform: none;
    animation: panelFadeIn 0.3s ease-out forwards;
}
.panel-profile.active {
    display: flex;
}
@keyframes panelFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* --- Sidebar stat flash --- */
@keyframes sidebarFlash {
    0%   { filter: brightness(1); }
    30%  { filter: brightness(2.5) drop-shadow(0 0 8px var(--gold)); }
    100% { filter: brightness(1); }
}
.sidebar-flash {
    animation: sidebarFlash 0.6s ease-out;
}

/* --- Loading screen --- */
.game-loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: radial-gradient(ellipse at center, var(--bg-card) 0%, var(--bg-body) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    transition: opacity 0.5s ease-out;
}
.game-loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}
.loading-logo {
    font-family: 'MedievalSharp', cursive;
    font-size: 2.8rem;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(var(--gold-rgb),0.5);
    letter-spacing: 2px;
}
.loading-bar-track {
    width: 280px;
    height: 6px;
    background: rgba(var(--white-rgb),0.08);
    border-radius: 3px;
    overflow: hidden;
}
.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--gold), var(--gold));
    border-radius: 3px;
    animation: loadingProgress 1.5s ease-out forwards;
}
@keyframes loadingProgress {
    0%   { width: 0%; }
    60%  { width: 70%; }
    100% { width: 100%; }
}
.loading-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    max-width: 320px;
    text-align: center;
}

/* --- Ambient particles canvas --- */
#profile-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}
.panel-profile {
    padding: 0;
    margin: -1.5rem;
}
.panel-profile.active {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    overflow: hidden;
}
.panel-profile .profile-arena {
    flex: 1;
}

/* --- Sidebar Summoner --- */
.sidebar-summoner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    cursor: pointer;
    position: relative;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}
.sidebar-summoner:hover,
.sidebar-summoner:focus-within {
    background: rgba(var(--gold-rgb), 0.08);
}
.sidebar-summoner:hover .sidebar-avatar {
    box-shadow: 0 0 0 2px rgba(var(--gold-rgb), 0.35);
}
.sidebar-summoner:hover .sidebar-summoner-chev {
    color: var(--gold);
    transform: translateY(-50%) translateX(2px);
}
.sidebar-summoner:hover .sidebar-summoner-title.is-placeholder {
    color: var(--gold);
}
.sidebar-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--gold);
    text-shadow: 0 1px 3px rgba(var(--black-rgb),0.5);
    background: linear-gradient(135deg, var(--bg-card), var(--border));
    border: 2px solid var(--gold);
    position: relative;
    transition: box-shadow 0.18s ease;
}
.sidebar-summoner-chev {
    position: absolute;
    top: 50%;
    right: 0.9rem;
    transform: translateY(-50%);
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    line-height: 1;
    color: rgba(var(--gold-rgb), 0.5);
    pointer-events: none;
    transition: color 0.18s ease, transform 0.18s ease;
}
.sidebar-summoner-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    padding-right: 1.2rem;
}
.sidebar-summoner-name {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: var(--text-main);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-summoner-title {
    font-size: 0.65rem;
    color: var(--gold);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    transition: color 0.18s ease;
}
.sidebar-summoner-title.is-placeholder {
    color: var(--text-muted, rgba(var(--gold-rgb), 0.55));
    font-weight: 500;
}

/* --- Bouton Mise a jour (centre header) --- */
/* Affiche par version-check.js quand /api/version.php renvoie une version !=
   window.APP_VERSION. Position absolute pour rester centre sans casser le
   layout flex existant (header-left/header-right). */
.game-header { position: relative; }
.header-update-btn {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, var(--red) 0%, var(--error-muted) 100%);
    color: #fff;
    border: 1px solid rgba(var(--red-rgb), 0.9);
    border-radius: 8px;
    padding: 6px 14px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: 0 0 0 0 rgba(var(--red-rgb), 0.8);
    animation: updateBtnPulse 1.6s ease-in-out infinite;
    z-index: 11;
    white-space: nowrap;
}
.header-update-btn:hover {
    filter: brightness(1.12);
    animation-play-state: paused;
}
.header-update-icon {
    display: inline-block;
    font-size: 1.1rem;
    line-height: 1;
    transform: translateY(-1px);
}
@keyframes updateBtnPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(var(--red-rgb), 0.75);
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(var(--red-rgb), 0);
        transform: translate(-50%, -50%) scale(1.035);
    }
}

/* --- Invitation de duel amical (in-header, non bloquant) --- */
.header-duel-invite {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(180deg, #1a1a2e, #0a0a1e);
    border: 1px solid rgba(var(--gold-rgb), 0.55);
    border-radius: 10px;
    padding: 6px 12px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.88rem;
    color: var(--text-main);
    box-shadow: 0 0 18px rgba(var(--gold-rgb), 0.3);
    animation: duelInvitePulse 1.4s ease-in-out infinite;
    z-index: 11;
    white-space: nowrap;
}
/* L'attribut natif `hidden` est ecrase par `display: inline-flex` ci-dessus
   (meme specificite, regle plus tard l'emporte). Override explicite. */
.header-duel-invite[hidden] { display: none !important; }
@keyframes duelInvitePulse {
    0%, 100% { box-shadow: 0 0 14px rgba(var(--gold-rgb), 0.22); }
    50%      { box-shadow: 0 0 22px rgba(var(--gold-rgb), 0.55); }
}
.header-duel-invite-icon {
    font-size: 1.1rem;
    color: var(--gold);
    text-shadow: 0 0 6px rgba(var(--gold-rgb), 0.6);
}
.header-duel-invite-text strong {
    color: var(--gold-light);
}
.header-duel-invite-timer {
    font-family: 'Oswald', sans-serif;
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.45);
    min-width: 32px;
    text-align: center;
}
.header-duel-invite-btn {
    padding: 4px 12px;
    border-radius: 5px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    border: 1px solid;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.header-duel-invite-accept {
    background: rgba(68, 204, 136, 0.18);
    border-color: rgba(68, 204, 136, 0.55);
    color: #88e8b0;
}
.header-duel-invite-accept:hover:not(:disabled) {
    background: rgba(68, 204, 136, 0.32);
    border-color: #44cc88;
    color: #fff;
}
.header-duel-invite-decline {
    background: rgba(var(--error-rgb), 0.15);
    border-color: rgba(var(--error-rgb), 0.5);
    color: #e08888;
}
.header-duel-invite-decline:hover:not(:disabled) {
    background: rgba(var(--error-rgb), 0.3);
    border-color: var(--error);
    color: #fff;
}
.header-duel-invite-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Pastille "Combat en cours" (header-left, boot check) --- */
.header-resume-combat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
    background: linear-gradient(180deg, var(--orange) 0%, #c66a1a 100%);
    color: #fff;
    border: 1px solid rgba(var(--orange-rgb), 0.9);
    border-radius: 8px;
    padding: 5px 12px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    box-shadow: 0 0 0 0 rgba(var(--orange-rgb), 0.7);
    animation: resumeCombatPulse 1.6s ease-in-out infinite;
    white-space: nowrap;
}
.header-resume-combat:hover {
    filter: brightness(1.12);
    animation-play-state: paused;
}
.header-resume-combat-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
}
.header-resume-combat-kind {
    color: #ffeacc;
    font-weight: 700;
    margin-left: 2px;
}
@keyframes resumeCombatPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(var(--orange-rgb), 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(var(--orange-rgb), 0);
        transform: scale(1.025);
    }
}

/* =====================================================================
   Mobile : scrollbar verticale cachee (scroll reste actif) + zoom bloque
   ---------------------------------------------------------------------
   Au lieu de scrollbar-width: none global (qui casse le desktop), on cible
   uniquement les viewports tactiles (pointer:coarse) ET les ecrans <=950px.
   Le scroll fonctionne toujours (touch swipe), juste la barre n'est plus
   rendue. Le pinch-zoom est deja bloque par le meta viewport
   user-scalable=no, mais on ajoute touch-action: manipulation pour bloquer
   aussi le double-tap zoom sur iOS (qui ignore parfois user-scalable).
   ===================================================================== */
@media (max-width: 1000px), (pointer: coarse) {
    /* Firefox : scrollbar invisible */
    html, body, .game-main, .panel, .sidebar,
    .panel-profile.active, .profile-info-panel,
    .emblem-editor-main {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    /* WebKit (Chrome/Safari) : scrollbar zero-width */
    html::-webkit-scrollbar,
    body::-webkit-scrollbar,
    .game-main::-webkit-scrollbar,
    .panel::-webkit-scrollbar,
    .sidebar::-webkit-scrollbar,
    .panel-profile.active::-webkit-scrollbar,
    .profile-info-panel::-webkit-scrollbar,
    .emblem-editor-main::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;
    }
    body {
        touch-action: manipulation; /* bloque double-tap zoom iOS */
    }
}

/* =====================================================================
   Rotate prompt : force le mode paysage sur telephone
   ---------------------------------------------------------------------
   Cache par defaut. Visible UNIQUEMENT en portrait mobile (max-width 900
   ET orientation portrait). Bloque tout le contenu derriere via z-index
   max et fond opaque.
   ===================================================================== */
.rotate-prompt {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: linear-gradient(180deg, var(--bg-deep, #0a0a14) 0%, var(--bg-body, #15131e) 100%);
    color: var(--gold, #c8a84e);
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
}
.rotate-prompt-inner {
    max-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}
.rotate-prompt-icon {
    color: var(--gold, #c8a84e);
    animation: rotate-prompt-spin 2.6s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(var(--gold-rgb, 200,168,78), 0.4));
}
@keyframes rotate-prompt-spin {
    0%, 30%   { transform: rotate(0deg); }
    50%, 75%  { transform: rotate(-90deg); }
    100%      { transform: rotate(0deg); }
}
.rotate-prompt-title {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    color: var(--gold, #c8a84e);
    margin: 0;
    text-shadow: 0 0 12px rgba(var(--gold-rgb, 200,168,78), 0.3);
}
.rotate-prompt-text {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.95rem;
    color: var(--text-main, #e0d6c0);
    margin: 0;
    line-height: 1.5;
}
@media (max-width: 900px) and (orientation: portrait) {
    .rotate-prompt { display: flex; }
    /* Empeche le scroll du jeu derriere */
    body { overflow: hidden; }
}

/* =====================================================================
   Burger flottant (mobile uniquement)
   ---------------------------------------------------------------------
   Le vrai burger #burger-btn est dans le header (cache sur mobile). Ce
   bouton flottant prend le relais et delegue son click au vrai burger
   pour reutiliser sa logique d'ouverture/fermeture sidebar.
   ===================================================================== */
.burger-floating {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 9001;
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 36px;
    height: 36px;
    padding: 7px 6px;
    background: rgba(var(--gold-rgb), 0.18);
    border: 1px solid rgba(var(--gold-rgb), 0.45);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.burger-floating:hover {
    background: rgba(var(--gold-rgb), 0.28);
    border-color: rgba(var(--gold-rgb), 0.7);
}
.burger-floating span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--gold);
    border-radius: 2px;
}

/* =====================================================================
   Burger button (mobile menu toggle) - cache desktop, visible sous 720px
   ===================================================================== */
.burger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 32px;
    height: 32px;
    padding: 6px 5px;
    background: rgba(var(--gold-rgb), 0.12);
    border: 1px solid rgba(var(--gold-rgb), 0.35);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.burger-btn:hover {
    background: rgba(var(--gold-rgb), 0.22);
    border-color: rgba(var(--gold-rgb), 0.6);
}
.burger-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--gold);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.2s;
}
.sidebar.open + .sidebar-overlay,
.sidebar-overlay.active { display: block; }
.sidebar-overlay { display: none; }

/* =====================================================================
   RESPONSIVE - Layout mobile (< 900px)
   ---------------------------------------------------------------------
   Sous 900px on bascule en layout mobile/tablette : sidebar en drawer
   (slide depuis la gauche), burger flottant visible, header masque, chat
   dock masque. Entre 900 et 1000px on garde le layout desktop (header +
   sidebar latérale) pour ne pas pénaliser les laptops compacts.
   ===================================================================== */
@media (max-width: 900px) {
    /* Header masque -> --header-h:0 pour que tous les panels avec
       calc(100vh - var(--header-h)) prennent toute la hauteur viewport. */
    :root { --header-h: 0px; }

    .burger-floating { display: flex; }

    /* Header masque sur mobile (le burger gere la sidebar drawer) */
    .game-header { display: none; }

    /* Sans header, rien ne force le layout a remplir l'ecran. On force la
       hauteur viewport (dvh = dynamic viewport, ignore les barres URL). */
    html, body { height: 100%; margin: 0; padding: 0; overflow: hidden; }
    .game-layout {
        height: 100vh;
        height: 100dvh;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        z-index: 9000;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        border-right: none;
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.5);
    }
    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(2px);
        z-index: 8999;
    }

    .game-main {
        padding: 0;
    }
    /* Beaucoup de panels ont margin:-1.5rem pour compenser le padding 1.5rem
       de game-main. Sur mobile, padding:0 -> ces margins negatifs font
       deborder les panels (canvas Phaser tronque, layouts qui debordent).
       On les neutralise tous d'un coup. */
    .panel-combat,
    .panel-profile,
    .panel-pvp, .panel-pvm, .panel-tower,
    .panel-inventory, .panel-sanctuary, .panel-market,
    .panel-friends, .panel-guild, .panel-bestiary,
    .panel-achievements, .panel-summoner, .panel-admin {
        margin: 0 !important;
    }

    /* Chat dock : masque sur mobile (manque de place) */
    .chat-dock { display: none !important; }
}

/* =====================================================================
   RESPONSIVE - Mobile paysage (jusqu'a iPhone Pro Max 932px)
   ---------------------------------------------------------------------
   Header masque pour gagner les ~50px verticaux precieux sur la hauteur
   tres courte (320-430px). La sidebar reste laterale mais le burger
   apparait pour pouvoir l'ouvrir si besoin (drawer dans une variante
   future). Chat dock egalement masque.
   ===================================================================== */
/* Note: les regles ci-dessus (@media max-width:1000px) couvrent deja les
   telephones paysage. On garde ce media pour les overrides specifiques
   au mobile paysage (compaction extreme du panel-profile dans profile.css). */
@media (max-width: 1000px) and (orientation: landscape) and (max-height: 500px) {
    /* Reserve aux overrides hauteur tres courte (320-500px). Les regles
       layout (header masque, drawer, etc.) sont deja prises par le media
       (max-width:1000px) au-dessus. */
}
