:root {
    /* Nouvelle Palette Riche */
    --lacquer-red: #4a0e0e;
    --lacquer-dark: #240707;
    --imperial-gold: #d4af37;
    --bright-gold: #f9d77e;
    --jade-green: #00a86b;
    --jade-dark: #005f3c;
    --parchment: #f0e6d2;
    --parchment-dark: #cabba0;
    
    /* Polices */
    --title-font: 'Cinzel Decorative', cursive;
    --body-font: 'Spectral', serif;
}

/* NOUVEAU : Le conteneur sert de base pour superposer les éléments */
.conteneur-icone {
  position: relative;
  width: 150px; 
  height: 150px;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.lore-block {
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-bottom: 30px;
    line-height: 1.6;
    font-style: italic;
    color: var(--parchment);
}

p {
    font-size: 1.2rem;
}


/* --- TAILLES PERSONNALISÉES DES ICÔNES DE RÔLES --- */
#icon-roi { width: 155px !important; height: 150px !important; }
#icon-emissaire { width: 200px !important; height: 147px !important; }
#icon-champion { width: 179px !important; height: 140px !important; }
#icon-divinite { width: 155px !important; height: 155px !important; }
#icon-reine { width: 150px !important; height: 165px !important; }
#icon-tour { width: 150px !important; height: 150px !important; }
#icon-fou { width: 155px !important; height: 170px !important; }
#icon-cavalier { width: 150px !important; height: 160px !important; }
#icon-pion { width: 150px !important; height: 160px !important; }
#icon-yaoguai { width: 160px !important; height: 160px !important; }
#icon-spectre { width: 165px !important; height: 170px !important; }


/* NOUVEAU : Le cadre fixe, avec une bordure épaisse et de couleur vive (ex: jaune fluo ou rouge) */
.cadre-pochoir {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 4px solid #FFEA00; 
  box-sizing: border-box;
  pointer-events: none; 
  z-index: 10;
}

/* NOUVEAU : L'icône qui peut s'agrandir (via une fonction JS ou CSS) sans affecter le cadre */
.icone-dynamique {
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease;
}

/* NOUVEAU : Exemple d'agrandissement de l'icône, le cadre restera intact */
.icone-dynamique:hover {
  transform: scale(1.5);
}

/* Reset et Base */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    background-color: var(--lacquer-dark);
    color: var(--parchment);
    font-family: var(--body-font);
    line-height: 1.7;
    overflow-x: hidden;
}

/* --- TEXTURE D'ARRIÈRE-PLAN --- */
.mythic-bg-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23090909' fill-opacity='0.4' fill-rule='evenodd'/%3E%3C/svg%3E"), linear-gradient(to bottom, var(--lacquer-dark), #1a0505);
    z-index: -1;
    pointer-events: none;
}

/* --- HEADER --- */
.main-header {
    height: 50vh;
    background: linear-gradient(to bottom, rgba(36, 7, 7, 0.6), rgba(36, 7, 7, 0.9)), url('./backgroundheader.png') center top/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-bottom: 4px solid var(--imperial-gold);
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}
/* --- ICONE DES RÔLES DANS L'ORNATE FRAME --- */
.role-icon {
    width: 140px; /* Taille de l'icône (ajustable) */
    height: 140px;
    object-fit: contain;
    display: block;
    margin: 0 auto 20px auto; /* Centre l'image et l'espace par rapport au titre */
    filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.4)); /* Halo doré subtil */
    transition: transform 0.3s ease;
}

.role-icon:hover {
    transform: scale(1.05); /* Petit effet de zoom au survol */
}

/* Modifie l'Ornate Frame pour s'adapter à l'image */
.role-page-container .ornate-frame {
    text-align: center;
    padding-top: 30px;
}

/* --- ICONE DES RÔLES DANS L'ORNATE FRAME --- */
.role-icon {
    width: 140px; /* Taille par défaut si tu n'as pas encore modifié */
    height: 140px;
    object-fit: contain; /* Empêche l'image de se déformer */
    display: block;
    margin: 0 auto 20px auto; /* Centre l'image et met un espace en dessous */
    filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.4)); /* Halo doré subtil */
    transition: transform 0.3s ease;
}

.role-icon:hover {
    transform: scale(1.05); /* Petit effet de zoom au survol */
}

/* Modifie l'Ornate Frame pour s'adapter à l'image */
.role-page-container .ornate-frame {
    text-align: center;
    padding-top: 30px;
}

.epic-title {
    font-family: var(--title-font);
    font-size: 5rem;
    color: var(--imperial-gold);
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 2px 0 var(--lacquer-dark), 0 4px 0 var(--lacquer-dark), 0 0 20px rgba(249, 215, 126, 0.6);
}

.epic-subtitle {
    font-family: var(--title-font);
    font-size: 3rem;
    color: var(--imperial-gold);
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 2px 0 var(--lacquer-dark), 0 4px 0 var(--lacquer-dark), 0 0 20px rgba(249, 215, 126, 0.6);
}

/* --- NAVIGATION (LOGIQUE CLIC ET BAS) --- */
.imperial-nav {
    position: absolute;
    bottom: -30px;
    right: 5%;
    z-index: 1100; /* Doit être au-dessus du main */
}

.nav-frame {
    background: linear-gradient(145deg, var(--lacquer-red), var(--lacquer-dark));
    padding: 15px 30px;
    border-radius: 8px;
    border: 3px solid var(--imperial-gold);
    box-shadow: 0 10px 25px rgba(0,0,0,0.7);
    position: relative;
}

.nav-links { list-style: none; padding: 0; margin: 0; display: flex; gap: 25px; }

.nav-item {
    text-decoration: none;
    color: var(--parchment);
    font-family: var(--title-font);
    text-transform: uppercase;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.nav-item:hover { color: var(--bright-gold); }

.dropdown { position: relative; }

.ornate-panel {
    display: none; /* Fermé par défaut */
    position: absolute;
    top: calc(100% + 20px); /* Déroule vers le BAS */
    left: 50%;
    transform: translateX(-50%);
    min-width: 280px;
    max-height: 1000px;
    overflow-y: auto;
    background: var(--lacquer-dark);
    border: 2px solid var(--imperial-gold);
    padding: 15px;
    list-style: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.9);
    z-index: 1200;
}

/* Classe activée par le clic JS */
.dropdown.active .ornate-panel {
    display: block;
    animation: slideDown 0.3s ease-out forwards;
}

.ornate-panel li a {
    color: var(--parchment);
    text-decoration: none;
    display: block;
    padding: 10px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    transition: all 0.3s;
}

.ornate-panel li a:hover {
    background: var(--lacquer-red);
    color: var(--bright-gold);
    padding-left: 15px;
}

/* --- CONTENU --- */
.scroll-container {
    max-width: 1100px;
    margin: 80px auto;
    padding: 0 20px;
}

.scroll-content {
    background: rgba(36, 7, 7, 0.85);
    padding: 60px;
    border-radius: 4px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    transition: opacity 0.5s ease;
}

.section-title {
    font-family: var(--title-font);
    font-size: 2.5rem;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--imperial-gold);
    display: inline-block;
}

.lore-heading {
    font-family: var(--title-font);
    color: var(--parchment-dark);
    border-left: 4px solid var(--imperial-gold);
    padding-left: 15px;
    margin-top: 40px;
}

.ornate-frame {
    border: 3px double var(--imperial-gold);
    padding: 40px;
    margin-bottom: 50px;
    background: rgba(0,0,0,0.3);
    text-align: center;
}

.sun-tzu-box {
    background: rgba(212, 175, 55, 0.1);
    border-left: 4px solid var(--imperial-gold);
    padding: 20px;
    margin: 30px 0;
    font-style: italic;
    color: var(--bright-gold);
}

.dragon-divider {
    height: 30px;
    margin: 50px 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10'%3E%3Cpath d='M0 5 Q 25 0, 50 5 T 100 5' stroke='%23d4af37' fill='none' stroke-width='2'/%3E%3C/svg%3E") center/contain no-repeat;
    opacity: 0.6;
}

/* --- ELEMENTS SPÉCIFIQUES --- */
.jiangshi-seal-box {
    display: flex;
    margin: 40px 0;
    border: 2px solid var(--imperial-gold);
    background: var(--lacquer-dark);
}

.seal-character {
    writing-mode: vertical-rl;
    background: var(--imperial-gold);
    color: var(--lacquer-dark);
    font-size: 3rem;
    padding: 20px;
   
}

.seal-content { padding: 30px; flex: 1; }

.kingdom-tablets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.tablet {
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 20px;
    background: rgba(0,0,0,0.2);
    transition: transform 0.3s;
}

.tablet:hover {
    transform: translateY(-5px);
    border-color: var(--imperial-gold);
}

.essence {
    color: var(--imperial-gold);
    font-weight: bold;
    font-size: 0.8rem;
    text-transform: uppercase;
}

/* --- SPA UI --- */
.btn-return {
    display: block;
    margin: 40px auto 0;
    background: var(--lacquer-red);
    color: var(--imperial-gold);
    border: 1px solid var(--imperial-gold);
    padding: 10px 30px;
    font-family: var(--title-font);
    cursor: pointer;
    transition: 0.3s;
}

.btn-return:hover {
    background: var(--imperial-gold);
    color: var(--lacquer-red);
}

/* --- GRILLE DES FACTIONS --- */
.faction-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-top: 40px;
    margin-bottom: 40px;
}

.faction-card {
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(212, 175, 55, 0.4); /* Or impérial atténué */
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.faction-card:hover {
    transform: translateY(-8px);
    border-color: var(--imperial-gold);
    box-shadow: 0 10px 20px rgba(212, 175, 55, 0.2);
    background: rgba(36, 7, 7, 0.8); /* Reflet laqué */
}

.faction-card img {
    width: 150px;
    height: 200px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.2));
}

.faction-card h4 {
    color: var(--parchment);
    font-family: var(--title-font);
    margin: 0;
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.faction-card:hover h4 {
    color: var(--bright-gold);
}



/* --- ANIMATIONS --- */
@keyframes slideDown {
    from { 
        opacity: 0; 
        transform: translate(-50%, -15px); 
    }
    to { 
        opacity: 1; 
        transform: translate(-50%, 0); 
    }
}

.entrance-anim { opacity: 0; transform: translateY(30px); transition: 0.8s ease-out; }
.entrance-anim.visible { opacity: 1; transform: translateY(0); }

/* Scrollbar Style */
.ornate-panel::-webkit-scrollbar { width: 6px; }
.ornate-panel::-webkit-scrollbar-track { background: var(--lacquer-dark); }
.ornate-panel::-webkit-scrollbar-thumb { background: var(--imperial-gold); border-radius: 10px; }

/* Responsive */
@media (max-width: 768px) {
    .epic-title { font-size: 2.5rem; }
    .imperial-nav { position: relative; bottom: auto; right: auto; margin-top: -30px; display: flex; justify-content: center; }
    .nav-frame { width: 95%; }
    .nav-links { gap: 10px; font-size: 0.7rem; }
    .ornate-panel { min-width: 90vw; }
}

/* --- LISTES DRAG & DROP ADMIN --- */
.draggable-list {
    list-style: none; 
    padding: 0; 
    margin: 0;
}

.draggable-item {
    background: var(--lacquer-red);
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 10px;
    margin-bottom: 5px;
    border-radius: 4px;
    color: var(--parchment);
    transition: background 0.2s;
}

.draggable-item:hover {
    background: #5a1111;
    border-color: var(--imperial-gold);
}

.draggable-item.separator {
    background: #1a0505;
    border-style: dashed;
    text-align: center;
    color: var(--parchment-dark);
}

/* --- EFFET BORDURE ARC-EN-CIEL TOURNANT --- */
.rainbow-wrapper {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 3px; /* Légèrement réduit pour être bien collé */
    border-radius: 12px;
    background: linear-gradient(120deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3, #ff0000);
    background-size: 300% 300%;
    animation: rainbow-flow 3s linear infinite;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
    width: max-content; /* <-- La magie est ici : ça épouse le contenu */
    max-width: 100%;
}

@keyframes rainbow-flow {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.rainbow-wrapper img {
    display: block;
    background-color: rgba(36,7,7,0.9);
    border-radius: 9px;
    max-width: 100%;
    height: auto;
}

/* --- SORTS & MAGIE --- */
.spell-header-container {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    margin-bottom: 40px;
    background: rgba(0,0,0,0.3);
    padding: 30px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 8px;
}

.spell-image-wrapper {
    flex: 0 0 300px;
    display: flex;
    justify-content: center;
}

.spell-image-wrapper img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
    border: 2px solid var(--imperial-gold);
}

.spell-title-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.spell-free-content {
    background: rgba(36, 7, 7, 0.85);
    padding: 40px;
    border-radius: 8px;
    border: 1px solid var(--imperial-gold);
    line-height: 1.9;
    font-size: 1.15rem;
    color: var(--parchment);
    box-shadow: inset 0 0 30px rgba(0,0,0,0.5);
}

.spell-free-content p {
    margin-bottom: 15px;
}

.spells-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

@media (max-width: 768px) {
    .spell-header-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .spell-image-wrapper {
        flex: 0 0 auto;
    }
}