
/* --- 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;
}
.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;
}
.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);
}
.game-header .user-name {
    color: var(--text-main);
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    margin-right: 0.8rem;
}
.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;
}
.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: 0.8rem 0;
    overflow-y: auto;
}
.sidebar-dragon-mini {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}
/* Dragon selector */
.sidebar-dragon-selector { position: relative; }
.sidebar-dragon-current {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
    position: relative;
}
.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;
}
.sidebar-combat-btn {
    background: rgba(200, 50, 50, 0.2);
    color: var(--error-warm);
    border: 1px solid var(--error-warm);
    animation: combatPulse 2s infinite;
}
@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;
}

/* --- 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 - 50px);
    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);
    }
}
