/**
 * edp-game.css — Feuille de style du moteur de jeu Echo de Plumes
 * 
 * Variables CSS initialisées par engine.js depuis EDP_CONFIG.theme
 * Style : manga/BD coloré — PAS le style noir et or du site
 */

/* ─────────────────────────────────────────────────────────────
   VARIABLES PAR DÉFAUT (écrasées par engine.js au runtime)
   ───────────────────────────────────────────────────────────── */

#game-container {
    --edp-primary:       #ff6b35;
    --edp-secondary:     #4ecdc4;
    --edp-background:    #1a1a2e;
    --edp-text:          #ffffff;
    --edp-font-title:    'Bangers', cursive;
    --edp-font-body:     'Comic Neue', 'Comic Sans MS', cursive;
    --edp-radius:        12px;

    /* Dérivées */
    --edp-primary-dark:  color-mix(in srgb, var(--edp-primary) 70%, black);
    --edp-overlay-bg:    rgba(10, 10, 20, 0.75);
    --edp-overlay-light: rgba(10, 10, 20, 0.55);
    --edp-bar-hp:        #4CAF50;
    --edp-bar-mana:      #4a90d9;
    --edp-bar-track:     rgba(255,255,255,0.15);
    --edp-shadow:        0 2px 12px rgba(0,0,0,0.6);
}

/* ─────────────────────────────────────────────────────────────
   RESET / BASE
   ───────────────────────────────────────────────────────────── */

#game-container *,
#game-container *::before,
#game-container *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

#game-container {
    font-family: var(--edp-font-body);
    color: var(--edp-text);
    background: var(--edp-background);

    /* Intégré dans la page WP : largeur max avec ratio 16:9 */
    position: relative;
    width: 100%;
    max-width: 1024px;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--edp-radius);
    box-shadow: 0 4px 32px rgba(0,0,0,0.8);

    display: flex;
    flex-direction: column;
    user-select: none;
}

/* Plein écran */
#game-container:fullscreen {
    max-width: 100%;
    border-radius: 0;
    aspect-ratio: unset;
    height: 100vh;
}

/* ─────────────────────────────────────────────────────────────
   BARRE STATS JOUEUR (haut)
   ───────────────────────────────────────────────────────────── */

#player-stats {
    position: relative;
    z-index: 20;
    background: var(--edp-background);
    border-bottom: 2px solid var(--edp-primary);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    font-size: 0.78em;
    font-family: var(--edp-font-body);
    flex-wrap: wrap;
}

#player-stats > div {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

#player-stats .bar-container {
    width: 60px;
    height: 8px;
    background: var(--edp-bar-track);
    border-radius: 4px;
    overflow: hidden;
}

#char-pv-bar,
#char-mana-bar {
    height: 100%;
    width: 100%;
    border-radius: 4px;
    transition: width 0.4s ease-in-out, background-color 0.4s;
    background-color: var(--edp-bar-hp);
}

#char-mana-bar {
    background-color: var(--edp-bar-mana);
}

#char-name {
    color: var(--edp-primary);
    font-weight: bold;
}

/* ─────────────────────────────────────────────────────────────
   FENÊTRE DE JEU (zone principale)
   ───────────────────────────────────────────────────────────── */

#game-window {
    position: relative;
    flex: 1;
    overflow: hidden;
    min-height: 0; /* important pour flex */
}

/* Fond de scène plein écran dans la zone */
#scene-background {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 0.5s ease;
}

/* ─────────────────────────────────────────────────────────────
   PERSONNAGE
   ───────────────────────────────────────────────────────────── */

#character-container {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 90%;
    display: flex;
    align-items: flex-end;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.4s ease;
}

#character-container.hidden {
    opacity: 0;
    pointer-events: none;
}

#character-container.fade-in {
    opacity: 1;
}

#character-img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(2px 4px 8px rgba(0,0,0,0.6));
}

/* ─────────────────────────────────────────────────────────────
   ICÔNE SAC (inventaire)
   ───────────────────────────────────────────────────────────── */

#inventory-icon {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 15;
    width: 38px;
    height: 38px;
    background: var(--edp-overlay-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M19 6h-2c0-2.76-2.24-5-5-5S7 3.24 7 6H5c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-7-3c1.66 0 3 1.34 3 3H9c0-1.66 1.34-3 3-3zm0 10c-1.66 0-3-1.34-3-3h2c0 .55.45 1 1 1s1-.45 1-1h2c0 1.66-1.34 3-3 3z'/%3E%3C/svg%3E") center/20px no-repeat;
    border-radius: 50%;
    border: 2px solid var(--edp-primary);
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
}

#inventory-icon:hover {
    transform: scale(1.15);
    background-color: var(--edp-primary);
}

/* ─────────────────────────────────────────────────────────────
   BOÎTE DE DIALOGUE
   ───────────────────────────────────────────────────────────── */

#dialogue-box {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: var(--edp-overlay-bg);
    backdrop-filter: blur(4px);
    padding: 14px 48px 14px 14px; /* droite : place pour le ▼ */
    min-height: 80px;
    border-top: 2px solid var(--edp-primary);
}

#speaker-name,
#speaker-player {
    display: inline-block;
    font-family: var(--edp-font-title);
    font-size: 0.9em;
    letter-spacing: 1px;
    padding: 2px 10px;
    border-radius: 4px;
    margin-bottom: 6px;
    background: var(--edp-primary);
    color: #fff;
    text-transform: uppercase;
}

#speaker-player {
    background: var(--edp-secondary);
    color: #000;
}

/* Badge nom sur fond (overlay bas-gauche de l'image) */
/* Le speaker-name est dans dialogue-box, mais on peut le repositionner */
/* selon le layout choisi — on laisse dans la boîte pour l'instant */

#dialogue-text {
    font-family: var(--edp-font-body);
    font-size: 1em;
    line-height: 1.5;
    color: var(--edp-text);
}

/* Indicateur "suite" — clignote */
#next-indicator {
    position: absolute;
    bottom: 10px;
    right: 14px;
    font-size: 1.2em;
    color: var(--edp-primary);
    display: none;
    animation: edp-blink 0.9s ease-in-out infinite;
}

@keyframes edp-blink {
    0%, 100% { opacity: 1; transform: translateY(0); }
    50%       { opacity: 0.2; transform: translateY(4px); }
}

/* ─────────────────────────────────────────────────────────────
   ICÔNE ŒIL (présenter un objet)
   ───────────────────────────────────────────────────────────── */

#eye-icon {
    position: absolute;
    bottom: 90px; /* au-dessus de la boîte de dialogue */
    right: 12px;
    z-index: 12;
    width: 34px;
    height: 34px;
    background: var(--edp-overlay-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z'/%3E%3C/svg%3E") center/18px no-repeat;
    border-radius: 50%;
    border: 2px solid var(--edp-secondary);
    cursor: pointer;
    display: none; /* Affiché par JS quand pertinent */
    transition: transform 0.2s;
}

#eye-icon:hover {
    transform: scale(1.15);
    background-color: var(--edp-secondary);
}

/* ─────────────────────────────────────────────────────────────
   ZONE DES CHOIX
   ───────────────────────────────────────────────────────────── */

#choices {
    position: relative;
    z-index: 20;
    background: var(--edp-background);
    padding: 10px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    flex-shrink: 0;
    visibility: hidden;
    border-top: 2px solid var(--edp-primary-dark);
    min-height: 56px; /* réserve l'espace même vide */
}

.choice-btn {
    font-family: var(--edp-font-body);
    font-size: 0.9em;
    background: var(--edp-primary);
    color: #fff;
    border: none;
    border-radius: var(--edp-radius);
    padding: 8px 18px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    box-shadow: var(--edp-shadow);
    max-width: 400px;
    text-align: center;
}

.choice-btn:hover {
    background: var(--edp-primary-dark);
    transform: translateY(-2px);
}

.choice-btn:active {
    transform: translateY(0);
}

/* ─────────────────────────────────────────────────────────────
   BOUTON PLEIN ÉCRAN
   ───────────────────────────────────────────────────────────── */

#btn-fullscreen {
    position: absolute;
    top: 10px;
    left: 12px;
    z-index: 25;
    background: var(--edp-overlay-bg);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    font-size: 1.1em;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#btn-fullscreen:hover {
    background: var(--edp-primary);
}

#btn-fullscreen.active {
    color: var(--edp-secondary);
}

/* ─────────────────────────────────────────────────────────────
   MODAL — base commune
   ───────────────────────────────────────────────────────────── */

.modal {
    position: absolute;
    inset: 0;
    z-index: 100;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--edp-background);
    border: 2px solid var(--edp-primary);
    border-radius: var(--edp-radius);
    padding: 24px;
    max-width: 90%;
    max-height: 85%;
    overflow-y: auto;
    position: relative;
}

.modal-content h2 {
    font-family: var(--edp-font-title);
    font-size: 1.5em;
    color: var(--edp-primary);
    letter-spacing: 2px;
    margin-bottom: 16px;
}

.modal .close {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 1.4em;
    cursor: pointer;
    color: rgba(255,255,255,0.6);
    line-height: 1;
    transition: color 0.2s;
}

.modal .close:hover {
    color: var(--edp-primary);
}

/* ─────────────────────────────────────────────────────────────
   MODAL COMBAT
   ───────────────────────────────────────────────────────────── */

#combat-modal {
    flex-direction: column;
    background: transparent;
}

.combat-content {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border: none;
    border-radius: 0;
    padding: 0;
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
        "hp-bars    hp-bars"
        "enemy      enemy"
        "status     status"
        "log        log"
        "actions    actions";
    overflow: hidden;
}

/* Fond de combat */
#combat-background {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

.combat-content > * {
    position: relative;
    z-index: 2;
}

/* Barres de vie en haut */
#health-bars {
    grid-area: hp-bars;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 12px;
    gap: 12px;
    background: rgba(0,0,0,0.7);
    border-bottom: 2px solid var(--edp-primary);
}

.bar-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

/* Bloc gauche : HP + Mana joueur empilés */
.bar-group:nth-child(1),
.bar-group:nth-child(2) {
    flex: 0 0 auto;
    width: 35%;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}

/* Bloc droite : HP ennemi, barre qui part de droite vers gauche */
.bar-group:last-child {
    flex: 0 0 auto;
    width: 35%;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

.bar-group:last-child .bar-container {
    direction: rtl; /* La barre se vide de droite à gauche */
}

.bar-label {
    font-family: var(--edp-font-title);
    font-size: 0.85em;
    letter-spacing: 1px;
    white-space: nowrap;
    color: #fff;
}

.bar-container {
    flex: 1;
    height: 10px;
    background: var(--edp-bar-track);
    border-radius: 5px;
    overflow: hidden;
}

/* Note : le CSS inline de _updateBar() override la couleur dynamiquement */
#player-health-bar,
#player-mana-bar,
#enemy-health-bar {
    height: 100%;
    width: 100%;
    border-radius: 5px;
    transition: width 0.4s ease-in-out;
    background-color: var(--edp-bar-hp);
}

#player-mana-bar {
    background-color: var(--edp-bar-mana);
}

#player-health-text,
#player-mana-text,
#enemy-health-text {
    font-size: 0.72em;
    white-space: nowrap;
    opacity: 0.85;
    min-width: 40px;
    text-align: center;
}

/* Image ennemi */
#enemy-container {
    grid-area: enemy;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    pointer-events: none;
}

#enemy-image {
    max-height: 100%;
    max-width: 70%;
    object-fit: contain;
    filter: drop-shadow(0 4px 16px rgba(0,0,0,0.8));
    transition: transform 0.1s;
}

#enemy-image.hit {
    filter: drop-shadow(0 0 12px #ff4444) brightness(1.5);
    transform: translateX(-8px);
}

/* Badges de statut */
#combat-status {
    grid-area: status;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(0,0,0,0.5);
    min-height: 28px;
}

.status-badge {
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
}

.status-badge--poison         { border-color: #9b59b6; color: #c39bd3; }
.status-badge--etourdissement { border-color: #f39c12; color: #f9ca74; }
.status-badge--boost_attaque  { border-color: #e74c3c; color: #f1948a; }
.status-badge--boost_defense  { border-color: #3498db; color: #85c1e9; }

/* Log de combat */
#combat-log {
    grid-area: log;
    background: rgba(0,0,0,0.65);
    padding: 6px 12px;
    max-height: 100px;
    overflow-y: auto;
    font-size: 0.82em;
    line-height: 1.4;
    scrollbar-width: thin;
    scrollbar-color: var(--edp-primary) transparent;
}

#combat-log::-webkit-scrollbar { width: 4px; }
#combat-log::-webkit-scrollbar-thumb { background: var(--edp-primary); border-radius: 2px; }

.log-line { margin-bottom: 2px; }
.log-line--damage  { color: #ff6b6b; }
.log-line--heal    { color: #6bff8e; }
.log-line--info    { color: #ccc; }
.log-line--miss    { color: #aaa; font-style: italic; }
.log-line--dodge   { color: var(--edp-secondary); }
.log-line--system  { color: var(--edp-primary); font-weight: bold; }

/* Boutons d'action combat */
#combat-actions {
    grid-area: actions;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.75);
    border-top: 2px solid var(--edp-primary-dark);
    justify-content: center;
}

.combat-btn {
    font-family: var(--edp-font-body);
    font-size: 0.85em;
    padding: 7px 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, opacity 0.2s;
    font-weight: bold;
}

.combat-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.combat-btn--attack     { background: #e74c3c; color: #fff; }
.combat-btn--attack:hover:not(:disabled)     { background: #c0392b; transform: translateY(-2px); }

.combat-btn--competence { background: #8e44ad; color: #fff; }
.combat-btn--competence:hover:not(:disabled) { background: #7d3c98; transform: translateY(-2px); }

.combat-btn--item       { background: #27ae60; color: #fff; }
.combat-btn--item:hover:not(:disabled)       { background: #1e8449; transform: translateY(-2px); }

.combat-btn--flee       { background: #7f8c8d; color: #fff; }
.combat-btn--flee:hover:not(:disabled)       { background: #626567; transform: translateY(-2px); }

/* Dégâts flottants */
.floating-text {
    font-family: var(--edp-font-title);
    font-size: 1.6em;
    font-weight: bold;
    letter-spacing: 2px;
    pointer-events: none;
    animation: edp-float-up 1.5s ease-out forwards;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.floating-text--damage { color: #ff4444; }
.floating-text--heal   { color: #44ff88; }
.floating-text--dodge  { color: var(--edp-secondary); font-size: 1.1em; }
.floating-text--miss   { color: #aaaaaa; font-size: 1em; }

@keyframes edp-float-up {
    0%   { opacity: 1;   transform: translate(-50%, -50%) scale(0.8); }
    20%  { opacity: 1;   transform: translate(-50%, -80%) scale(1.2); }
    100% { opacity: 0;   transform: translate(-50%, -160%) scale(1); }
}

/* ─────────────────────────────────────────────────────────────
   MODAL INVENTAIRE
   ───────────────────────────────────────────────────────────── */

#inventory-modal .modal-content.inventory-modal-content {
    width: 80%;
    max-width: 80%;
    max-height: 82%;
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.inventory-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    padding-bottom: 10px;
}

.inventory-title {
    font-family: var(--edp-font-title);
    font-size: 1.3em;
    color: var(--edp-primary);
    letter-spacing: 2px;
    margin: 0;
}

.inventory-count {
    font-size: 0.75em;
    color: rgba(255,255,255,0.4);
}

/* Grille d'items */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 10px;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--edp-primary) transparent;
    min-height: 300px;
}

.inventory-grid::-webkit-scrollbar { width: 4px; }
.inventory-grid::-webkit-scrollbar-thumb { background: var(--edp-primary); border-radius: 2px; }

/* Carte item */
.inv-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 6px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.08);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    text-align: center;
    height: 105px;
}

.inv-card:hover {
    background: rgba(255,255,255,0.11);
    border-color: var(--edp-primary);
    transform: translateY(-2px);
}

/* Carte équipée : bordure dorée */
.inv-card--equipped {
    border-color: #f9ca24;
    background: rgba(249,202,36,0.08);
}

.inv-card--equipped:hover {
    border-color: #f9ca24;
    background: rgba(249,202,36,0.15);
}

/* Badge "équipé" en coin haut-droit */
.inv-card__equipped-badge {
    position: absolute;
    top: 4px;
    right: 5px;
    font-size: 0.6em;
    background: #f9ca24;
    color: #000;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: bold;
    line-height: 1.4;
}

/* Icône */
.inv-card__icon {
    width: 58px;
    height: 58px;
    object-fit: contain;
    border-radius: 6px;
    background: rgba(0,0,0,0.25);
    padding: 4px;
    flex-shrink: 0;
}

/* Nom */
.inv-card__name {
    font-size: 0.72em;
    line-height: 1.2;
    color: #fff;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Capsule type */
.inv-card__type {
    font-size: 0.6em;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 20px;
    line-height: 1.4;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.inv-type--weapon     { background: rgba(231,76,60,0.25);   color: #ff8a80; border: 1px solid #e74c3c; }
.inv-type--armor      { background: rgba(52,152,219,0.25);  color: #82c4f8; border: 1px solid #3498db; }
.inv-type--helmet     { background: rgba(41,128,185,0.25);  color: #7fb3d3; border: 1px solid #2980b9; }
.inv-type--ring       { background: rgba(155,89,182,0.25);  color: #c9a0e8; border: 1px solid #9b59b6; }
.inv-type--amulet     { background: rgba(142,68,173,0.25);  color: #c39bd3; border: 1px solid #8e44ad; }
.inv-type--consumable { background: rgba(39,174,96,0.25);   color: #82e0aa; border: 1px solid #27ae60; }
.inv-type--quest      { background: rgba(243,156,18,0.25);  color: #f9ca74; border: 1px solid #f39c12; }
.inv-type--default    { background: rgba(255,255,255,0.1);  color: #ccc;    border: 1px solid #666; }

.empty {
    color: rgba(255,255,255,0.35);
    font-style: italic;
    font-size: 0.85em;
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px 0;
}

/* ─────────────────────────────────────────────────────────────
   MODAL DÉTAIL OBJET
   ───────────────────────────────────────────────────────────── */

#item-detail-modal .modal-content {
    text-align: center;
    max-width: 380px;
}

#item-detail-modal img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
}

#item-detail-modal h2 {
    font-size: 1.2em;
    margin-bottom: 8px;
}

#item-detail-modal p {
    font-size: 0.88em;
    color: rgba(255,255,255,0.75);
    margin-bottom: 12px;
    line-height: 1.4;
}

.item-effets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-bottom: 16px;
}

.item-effets span {
    font-size: 0.8em;
    background: rgba(255,107,53,0.2);
    border: 1px solid var(--edp-primary);
    padding: 2px 8px;
    border-radius: 6px;
    color: var(--edp-primary);
}

.item-action-btn {
    font-family: var(--edp-font-body);
    background: var(--edp-primary);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: var(--edp-radius);
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.2s;
}

.item-action-btn:hover { background: var(--edp-primary-dark); }

/* ─────────────────────────────────────────────────────────────
   MODALES GÉNÉRIQUES (game over, fin épisode, pause, question)
   ───────────────────────────────────────────────────────────── */

.gameover-modal .modal-content,
.episode-end-modal .modal-content,
.pause-modal .modal-content,
.question-modal .modal-content {
    text-align: center;
    min-width: 280px;
}

.gameover-modal .modal-content h2 { color: #e74c3c; }
.episode-end-modal .modal-content h2 { color: #f9ca24; }
.pause-modal .modal-content h2 { color: var(--edp-secondary); }

.gameover-modal p,
.episode-end-modal p,
.pause-modal p {
    color: rgba(255,255,255,0.75);
    margin-bottom: 20px;
    font-size: 0.9em;
}

/* Boutons de ces modales */
.gameover-modal button,
.episode-end-modal button,
.pause-modal button {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    padding: 10px;
    font-family: var(--edp-font-body);
    font-size: 1em;
    background: var(--edp-primary);
    color: #fff;
    border: none;
    border-radius: var(--edp-radius);
    cursor: pointer;
    transition: background 0.2s;
}

.gameover-modal button:hover,
.episode-end-modal button:hover,
.pause-modal button:hover {
    background: var(--edp-primary-dark);
}

/* Question */
.question-modal h2 {
    color: var(--edp-text);
    font-family: var(--edp-font-body);
    font-size: 1.1em;
    margin-bottom: 14px;
}

#question-input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid var(--edp-primary);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-family: var(--edp-font-body);
    font-size: 1em;
    margin-bottom: 12px;
    outline: none;
}

#question-input:focus {
    border-color: var(--edp-secondary);
}

#question-submit {
    padding: 8px 20px;
    background: var(--edp-primary);
    color: #fff;
    border: none;
    border-radius: var(--edp-radius);
    font-family: var(--edp-font-body);
    cursor: pointer;
    transition: background 0.2s;
}

#question-submit:hover { background: var(--edp-primary-dark); }

/* ─────────────────────────────────────────────────────────────
   NOTIFICATIONS (toasts)
   ───────────────────────────────────────────────────────────── */

#notif-container {
    position: absolute;
    top: 50px;
    right: 12px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 280px;
}

.notif {
    font-size: 0.82em;
    padding: 8px 14px;
    border-radius: 8px;
    border-left: 3px solid;
    background: rgba(10,10,20,0.92);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.notif--visible {
    opacity: 1;
    transform: translateX(0);
}

.notif--info    { border-color: var(--edp-secondary); }
.notif--warning { border-color: #f9ca24; color: #f9ca24; }
.notif--error   { border-color: #e74c3c; color: #ff6b6b; }
.notif--success { border-color: #6bff8e; color: #6bff8e; }

/* ─────────────────────────────────────────────────────────────
   LOADING
   ───────────────────────────────────────────────────────────── */

#loading-screen {
    position: absolute;
    inset: 0;
    z-index: 300;
    background: var(--edp-background);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.15);
    border-top-color: var(--edp-primary);
    border-radius: 50%;
    animation: edp-spin 0.8s linear infinite;
}

@keyframes edp-spin {
    to { transform: rotate(360deg); }
}

/* ─────────────────────────────────────────────────────────────
   INDICATEUR DE SAUVEGARDE
   ───────────────────────────────────────────────────────────── */

#save-indicator {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    font-size: 0.8em;
    padding: 4px 12px;
    border-radius: 12px;
    background: rgba(0,0,0,0.7);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
}

.save-indicator--saving  { color: #f9ca24; }
.save-indicator--success { color: #6bff8e; }
.save-indicator--error   { color: #ff6b6b; }

/* ─────────────────────────────────────────────────────────────
   START SCREEN (créé dynamiquement)
   ───────────────────────────────────────────────────────────── */

#start-screen {
    position: absolute;
    inset: 0;
    z-index: 250;
    background: var(--edp-background);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
}

#start-screen h1 {
    font-family: var(--edp-font-title);
    font-size: 2.5em;
    color: var(--edp-primary);
    letter-spacing: 4px;
    text-shadow: 0 0 20px rgba(255,107,53,0.4);
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE MOBILE
   ───────────────────────────────────────────────────────────── */

@media (max-width: 600px) {

    #player-stats {
        font-size: 0.68em;
        gap: 8px;
        padding: 4px 8px;
    }

    #player-stats .bar-container {
        width: 40px;
    }

    #dialogue-box {
        padding: 10px 38px 10px 10px;
        min-height: 70px;
    }

    #dialogue-text {
        font-size: 0.88em;
    }

    #choices {
        padding: 8px;
        gap: 6px;
    }

    .choice-btn {
        font-size: 0.82em;
        padding: 7px 12px;
    }

    .combat-btn {
        font-size: 0.75em;
        padding: 6px 10px;
    }

    #combat-log {
        max-height: 70px;
        font-size: 0.75em;
    }

    #inventory-modal .modal-content {
        grid-template-columns: 1fr;
    }

    .floating-text {
        font-size: 1.2em;
    }
}



/* ─── Transitions de scène ───────────────────────────────────────── */

#edp-transition-fondu {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    background: black;
    pointer-events: none;
    z-index: 200;
    opacity: 0;
}

#edp-transition-rideau {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    background: black;
    pointer-events: none;
    z-index: 200;
    clip-path: inset(0 0 100% 0);
}

/* Fondu */
#edp-transition-fondu.trans-fondu-out { animation: transFonduOut var(--trans-duration, 1s) forwards; }
#edp-transition-fondu.trans-fondu-in  { animation: transFonduIn  var(--trans-duration, 1s) forwards; }


@keyframes transFonduOut { from { opacity: 0; } to { opacity: 1; } }
@keyframes transFonduIn  { from { opacity: 1; } to { opacity: 0; } }

/* Rideau haut → bas */
#edp-transition-rideau.trans-rideau-haut-out { animation: transRideauHautOut var(--trans-duration, 1s) forwards; }
#edp-transition-rideau.trans-rideau-haut-in  { animation: transRideauHautIn  var(--trans-duration, 1s) forwards; }

@keyframes transRideauHautOut { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0% 0); } }
@keyframes transRideauHautIn  { from { clip-path: inset(0 0 0% 0); }   to { clip-path: inset(0 0 100% 0); } }

/* Rideau bas → haut */
#edp-transition-rideau.trans-rideau-bas-out { animation: transRideauBasOut var(--trans-duration, 1s) forwards; }
#edp-transition-rideau.trans-rideau-bas-in  { animation: transRideauBasIn  var(--trans-duration, 1s) forwards; }

@keyframes transRideauBasOut { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0% 0 0 0); } }
@keyframes transRideauBasIn  { from { clip-path: inset(0% 0 0 0); }   to { clip-path: inset(100% 0 0 0); } }

/* Rideau droite → gauche */
#edp-transition-rideau.trans-rideau-droite-out { animation: transRideauDroiteOut var(--trans-duration, 1s) forwards; }
#edp-transition-rideau.trans-rideau-droite-in  { animation: transRideauDroiteIn  var(--trans-duration, 1s) forwards; }

@keyframes transRideauDroiteOut { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0% 0 0); } }
@keyframes transRideauDroiteIn  { from { clip-path: inset(0 0% 0 0); }   to { clip-path: inset(0 100% 0 0); } }

/* Rideau gauche → droite */
#edp-transition-rideau.trans-rideau-gauche-out { animation: transRideauGaucheOut var(--trans-duration, 1s) forwards; }
#edp-transition-rideau.trans-rideau-gauche-in  { animation: transRideauGaucheIn  var(--trans-duration, 1s) forwards; }

@keyframes transRideauGaucheOut { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0%); } }
@keyframes transRideauGaucheIn  { from { clip-path: inset(0 0 0 0%); }   to { clip-path: inset(0 0 0 100%); } }

/* Iris */
#edp-transition-rideau.trans-iris-in { animation: transIrisOut var(--trans-duration, 1s) forwards; }
#edp-transition-rideau.trans-iris-out  { animation: transIrisIn  var(--trans-duration, 1s) forwards; }

@keyframes transIrisOut { from { clip-path: circle(75%); } to { clip-path: circle(0%); } }
@keyframes transIrisIn  { from { clip-path: circle(0%); }  to { clip-path: circle(75%); } }