/* ======================================================= */
/* ---      Dies Nox - L'Oracle des Murmures CSS       --- */
/* ---              Refonte par Gemini                 --- */
/* ======================================================= */

:root {
    /* Couleurs importées directement du site Dies Nox pour une cohérence parfaite */
    --nox-bg: #030407;
    --nox-primary: #a8b3c3;
    --nox-glow: #d4e1f7;
    --dies-primary: #b48d4b;
    --dies-glow: #ffe8a9;
    --dies-text: #4E443A;
    --danger: #b33a3a; /* Un rouge plus sombre et thématique */
    --success: #6c8a3e; /* Un vert plus sobre */

    /* Polices importées du site Dies Nox */
    --font-title: 'Cinzel', serif;
    --font-body: 'Lora', serif; /* On garde Lora qui a un feeling "parchemin" adapté */
}

/* --- Base et animations --- */

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; translateY(0); }
}

@keyframes card-deal {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Animations de flash améliorées avec les couleurs du thème */
@keyframes flash-red {
    0%, 100% { color: var(--nox-glow); text-shadow: none; }
    50% { color: var(--danger); text-shadow: 0 0 10px var(--danger); }
}

@keyframes flash-gold {
    0%, 100% { color: var(--dies-glow); text-shadow: none; }
    50% { color: var(--dies-glow); text-shadow: 0 0 10px var(--dies-glow); }
}

/* --- Corps de la page --- */

body {
    /* On utilise le même fond que le portail du site principal */
    background: radial-gradient(ellipse at center, #1b2735 0%, #090a0f 100%);
    color: var(--nox-primary);
    font-family: var(--font-body);
    font-size: 16px;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

/* --- Conteneur principal du jeu --- */

#game-container {
    width: 100%;
    max-width: 900px;
    height: 95vh;
    max-height: 800px;
    /* On applique le même fond texturé que les pages du site principal */
    background:
        radial-gradient(ellipse at center, rgba(27, 39, 53, 0.6) 0%, rgba(9, 10, 15, 0.9) 100%),
        url(https://www.transparenttextures.com/patterns/stardust.png);
    border: 1px solid rgba(180, 141, 75, 0.3); /* Bordure dorée subtile */
    box-shadow:
        inset 0 0 15px rgba(0,0,0,0.5),
        0 0 30px rgba(0,0,0,0.4);
    border-radius: 8px; /* Bords légèrement arrondis comme sur le site */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Pour que les coins arrondis s'appliquent partout */
}

/* --- Header --- */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-bottom: 1px solid rgba(180, 141, 75, 0.3);
    flex-shrink: 0;
    background-color: rgba(0,0,0,0.2); /* Léger fond pour le démarquer */
}

header h1 {
    font-family: var(--font-title);
    color: var(--dies-glow);
    font-size: 1.8em;
    margin: 0;
    text-align: center;
    flex-grow: 1;
    text-shadow: 0 0 10px rgba(255, 232, 169, 0.5); /* Lueur dorée */
}

/* --- Styles unifiés pour les boutons du Header --- */

/* 1. La règle COMMUNE pour les 3 boutons */
#back-to-site-button, 
#rules-button, 
#play-pause-button {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 35px;
    background: transparent;
    border: 1px solid var(--dies-primary);
    color: var(--dies-primary);
    font-family: var(--font-title);
    transition: all 0.3s ease;
    cursor: pointer;
    /* La forme "coins coupés" appliquée à tous */
    clip-path: polygon(8px 0%, 100% 0%, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0% 100%, 0% 8px);
}

/* 2. Les règles SPÉCIFIQUES */

/* Pour le bouton "Retour au site" qui contient du texte */
#back-to-site-button {
    gap: 10px;
    padding: 0 20px;
    font-size: 0.8em;
    letter-spacing: 1px;
    text-decoration: none;
    margin-right: 15px; /* Espace avec le bouton des règles */
}

/* Pour les boutons "?" et "Play" qui sont des carrés avec une icône */
#rules-button, 
#play-pause-button {
    width: 35px; /* Pour qu'ils soient carrés */
    font-size: 1em;
    padding: 0; /* Pas de padding interne */
}

/* On ajoute un peu d'espace à gauche du titre pour équilibrer */
header h1 {
    margin-left: 15px;
}


/* 3. L'effet de survol COMMUN */
#back-to-site-button:hover, 
#rules-button:hover, 
#play-pause-button:hover {
    background-color: rgba(180, 141, 75, 0.1);
    color: var(--dies-glow);
    text-shadow: 0 0 8px var(--dies-glow);
    border-color: var(--dies-glow);
}

/* --- Section principale (cartes & rencontres) --- */

main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 25px;
    overflow: hidden;
}

#encounter-section {
    text-align: center;
    animation: fadeIn 0.5s;
    min-height: 100px;
    margin-bottom: 20px;
}

.encounter-title {
    font-family: var(--font-title);
    font-size: 1.7em;
    color: var(--dies-glow);
    margin-bottom: 10px;
}

.encounter-desc {
    font-size: 1.1em;
    line-height: 1.6;
    font-style: italic;
    color: var(--nox-primary);
}

/* --- Cartes d'action --- */

#action-cards-section {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 25px;
    flex-wrap: wrap;
    min-height: 200px;
}

.action-card {
    border: 1px solid transparent; /* Bordure transparente par défaut */
    background-color: rgba(0,0,0,0.3);
    padding: 20px;
    min-width: 220px;
    flex: 1;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.3s ease-out;
    animation: card-deal 0.5s ease-out;
    animation-fill-mode: backwards;
    border-radius: 6px; /* Bords arrondis pour les cartes */
    box-shadow: inset 0 0 10px rgba(0,0,0,0.4);
    position: relative;
}

/* Lueur dorée au survol */
.action-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
    border-color: var(--dies-primary);
}

/* Petit ornement sur les cartes pour le style */
.action-card::after {
    content: '';
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 20px;
    height: 1px;
    background: var(--dies-primary);
    opacity: 0.5;
    transition: all 0.3s ease;
}

.action-card:hover::after {
    width: 40px;
    opacity: 1;
    box-shadow: 0 0 5px var(--dies-primary);
}

.card-title {
    font-family: var(--font-title);
    font-size: 1.3em;
    color: var(--dies-glow);
    margin-bottom: 10px;
}

.card-character {
    font-size: 0.8em;
    font-style: italic;
    color: var(--nox-primary);
    opacity: 0.7;
    margin-bottom: 15px;
}

.card-desc {
    flex-grow: 1;
    margin-bottom: 15px;
    color: var(--nox-primary);
}

.card-effects {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(180, 141, 75, 0.2);
    font-size: 0.9em;
    font-family: var(--font-title);
    color: var(--nox-primary);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.effect-indicator + .effect-indicator::before {
    content: '|';
    color: var(--dies-primary);
    opacity: 0.4;
    font-weight: bold;
    margin: 0 12px;
}

/* --- Footer et Stats --- */

footer {
    border-top: 1px solid rgba(180, 141, 75, 0.3);
    padding: 20px 25px;
    flex-shrink: 0;
    background-color: rgba(0,0,0,0.2);
}

#stats-container {
    display: flex;
    justify-content: space-around;
}

.stat { text-align: center; }

.stat-label {
    font-size: 0.8em;
    text-transform: uppercase;
    color: var(--dies-primary);
    opacity: 0.8;
    margin-right: 10px;
}

.stat-value {
    font-family: var(--font-title);
    font-size: 1.7em;
    color: var(--nox-glow);
    transition: all 0.5s;
}

.stat-value.flash-red { animation: flash-red 1s; }
.stat-value.flash-gold { animation: flash-gold 1s; }


.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 4, 7, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center; 
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.modal-content {
    background:
        radial-gradient(ellipse at center, rgba(27, 39, 53, 0.6) 0%, rgba(9, 10, 15, 0.9) 100%),
        url(https://www.transparenttextures.com/patterns/stardust.png);
    border: 1px solid var(--dies-primary);
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    border-radius: 8px;
    padding: 40px;
    max-width: 600px;
    position: relative;
    color: var(--nox-primary);

    max-height: 90vh;   
    overflow-y: auto;
    flex-shrink: 0;
}

.modal-content h2 {
    font-family: var(--font-title);
    color: var(--dies-glow);
    margin-top: 0;
    text-align: center;
}

.modal-content .divider {
    margin: 15px 0;
    height: 1px;
    width: 100%;
    background: linear-gradient(to right, transparent, var(--dies-primary), transparent);
}

.modal-content ul {
    line-height: 1.8;
    padding-left: 20px;
}

#close-modal-button {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2em;
    color: var(--dies-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}
#close-modal-button:hover {
    transform: scale(1.2);
    text-shadow: 0 0 10px var(--dies-glow);
}

.hidden { display: none; }

/* --- Contrôles Musique --- */

#music-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

#volume-slider {
    width: 100px;
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    background: rgba(180, 141, 75, 0.4);
    outline: none;
    cursor: pointer;
    border-radius: 2px;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--dies-primary);
    border-radius: 50%;
    border: 2px solid var(--nox-bg);
    transition: background-color 0.2s;
}
#volume-slider::-webkit-slider-thumb:hover { background: var(--dies-glow); }

#volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--dies-primary);
    border-radius: 50%;
    border: 2px solid var(--nox-bg);
}
}

/* --- Responsive --- */

@media (max-width: 768px) {
    #action-cards-section { flex-direction: column; }
    header h1 { font-size: 1.5em; }
    footer { padding: 15px; }
    #stats-container { flex-wrap: wrap; gap: 15px; }
    .stat { flex-basis: 40%; } /* Deux stats par ligne */
}