/* ==========================================================================
   RESets & VARIABLES
   ========================================================================== */
:root {
    --c-bg: #0a0a09;
    --c-gold: #e7ba80;
    --c-gold-dim: #99784e;
    --c-overlay: rgba(10, 10, 9, 0.85);
    --c-surface: rgba(20, 20, 18, 0.95);
    --c-border: rgba(231, 186, 128, 0.2);
    --c-border-hover: rgba(231, 186, 128, 0.5);
    --c-danger: #ef4444;

    --f-heading: 'Cinzel', serif;
    --f-body: 'Cormorant Garamond', serif;
}

* { box-sizing: border-box; }
body, html {
    margin: 0; padding: 0;
    width: 100%; height: 100%;
    overflow: hidden;
    background-color: var(--c-bg);
    font-family: var(--f-body);
    color: #fff;
    user-select: none;
}

/* ==========================================================================
   CANVAS LAYERS
   ========================================================================== */
#c-canvas-wrap {
    position: absolute; inset: 0; z-index: 1;
}
#c-canvas-wrap canvas { /* WebGL */
    display: block; width: 100%; height: 100%; outline: none;
}
#c-css2d {
    position: absolute; inset: 0; z-index: 2;
    pointer-events: none; /* La scène CSS laisse passer les clics au rendu WebGL */
}

/* ==========================================================================
   LOADER
   ========================================================================== */
#c-loader {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--c-bg);
    display: flex; justify-content: center; align-items: center;
    transition: opacity 0.8s ease;
}
.c-loader-inner { text-align: center; width: 280px; }

/* Logo dans le loader */
.c-loader-logo {
    width: 130px; height: 130px; object-fit: contain;
    margin-bottom: 2rem;
    animation: pulse-logo 2.5s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(231,186,128,0.5));
}
@keyframes pulse-logo {
    0%, 100% { opacity: 0.7; transform: scale(0.95); filter: drop-shadow(0 0 10px rgba(231,186,128,0.3)); }
    50% { opacity: 1; transform: scale(1.05); filter: drop-shadow(0 0 30px rgba(231,186,128,0.8)); }
}

.c-loader-label { font-family: var(--f-heading); font-size: 0.8rem; letter-spacing: 0.15em; color: var(--c-gold-dim); margin-bottom: 1.5rem; text-transform: uppercase; }
.c-loader-bar-wrap { width: 100%; height: 2px; background: rgba(231,186,128,0.1); margin-bottom: 0.5rem; overflow: hidden; }
#c-loader-bar { width: 0%; height: 100%; background: linear-gradient(90deg, transparent, var(--c-gold), transparent); background-size: 200% 100%; animation: shimmer 1.5s infinite; transition: width 0.2s ease; }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
#c-loader-pct { font-family: monospace; font-size: 0.75rem; color: rgba(255,255,255,0.5); }

@keyframes pulse-gold { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; text-shadow: 0 0 15px var(--c-gold); } }

/* ==========================================================================
   MENU PRINCIPAL (TRAÇA UI)
   ========================================================================== */
#c-menu {
    position: fixed; inset: 0; z-index: 5000;
    transition: opacity 1s ease;
    overflow: hidden; /* Important : contient la vidéo positionnée absolument */
}

/* Couche de transition fondu noir interne au menu */
#t-overlay {
    position: fixed; inset: 0;
    background: #0e0905;
    z-index: 9999;
    opacity: 0; pointer-events: none;
    transition: opacity 0.35s ease;
}
#t-overlay.on { opacity: 1; pointer-events: all; }

/* Ecrans */
.screen {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    opacity: 0; pointer-events: none;
    transition: opacity 0.5s ease;
}
.screen.active { opacity: 1; pointer-events: all; }

/* Fond photo et vignette */
.s-bg {
    position: absolute; inset: 0;
    background-size: cover; background-position: center; z-index: 0;
}
.s-bg::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 45%, transparent 10%, rgba(10,5,2,0.55) 100%),
                linear-gradient(to bottom, rgba(10,5,2,0.4) 0%, rgba(10,5,2,0.1) 50%, rgba(10,5,2,0.65) 100%);
}
#s-menu .s-bg   { background-image: none; background: transparent; }
#s-options .s-bg{ background-image: url('../../assets/images/ui/bg-options.jpg'); }
#s-credits .s-bg{ background-image: url('../../assets/images/ui/bg-credits.jpg'); }

/* Contenu */
.s-body {
    position: relative; z-index: 2; flex: 1;
    display: flex; flex-direction: column; align-items: center;
}

/* Ornement horizontal */
.orn { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 340px; }
.orn-line { flex: 1; height: 1px; background: linear-gradient(to right, transparent, rgba(201,169,110,0.6), transparent); }
.orn-gem { color: #c9a96e; font-size: 0.55rem; opacity: 0.75; }

/* Menu Principal */
#btn-settings {
    position: absolute; top: 22px; right: 22px; z-index: 10;
    width: 44px; height: 44px; border-radius: 50%;
    border: 1px solid rgba(201,169,110,0.45); background: rgba(14,9,5,0.55);
    backdrop-filter: blur(10px); color: #c9a96e;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: border-color 0.2s, transform 0.35s;
}
#btn-settings:hover { border-color: #c9a96e; transform: rotate(72deg); }
#btn-settings svg { width: 20px; height: 20px; }

.menu-center {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 16px;
    padding: 60px 24px 0; animation: fadeUp 1.1s ease both;
}
.menu-logo { width: clamp(180px, 32vw, 320px); filter: drop-shadow(0 6px 28px rgba(201,169,110,0.5)); }
.menu-sub { font-family: var(--f-heading); font-size: clamp(0.55rem, 1.3vw, 0.75rem); letter-spacing: 0.28em; text-transform: uppercase; color: #c9a96e; opacity: 0.8; }
.menu-bottom { padding: 0 24px 60px; display: flex; flex-direction: column; align-items: center; animation: fadeUp 1.4s ease both; }

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

/* Boutons principaux (Orné & Manuscrit) */
.btn-main {
    position: relative; padding: 12px 64px;
    font-family: 'Cormorant Garamond', serif; font-size: 1.6rem; font-style: italic; font-weight: 300;
    color: #e7ba80; text-transform: capitalize; letter-spacing: 0.1em;
    border: 1px solid rgba(231,186,128,0.4);
    background: rgba(10,5,2,0.4); outline: none; cursor: pointer; transition: all 0.4s ease;
    backdrop-filter: blur(4px);
    overflow: hidden;
}
.btn-main::before, .btn-main::after {
    content: '✦'; position: absolute; top: 50%; transform: translateY(-50%);
    font-size: 0.7rem; color: rgba(231,186,128,0.6); font-style: normal;
    transition: all 0.4s ease;
}
.btn-main::before { left: 24px; }
.btn-main::after { right: 24px; }

.btn-main:hover {
    transform: translateY(-2px);
    border-color: rgba(231,186,128,1);
    background: rgba(231,186,128,0.08);
    color: #fff;
    box-shadow: 0 0 20px rgba(231,186,128,0.2) inset, 0 6px 20px rgba(0,0,0,0.6);
}
.btn-main:hover::before, .btn-main:hover::after {
    color: #fff; text-shadow: 0 0 10px #e7ba80;
}
.btn-main:active { transform: translateY(1px); }

/* ← Retour */
.btn-back {
    position: absolute; top: 22px; left: 22px; z-index: 10;
    width: 44px; height: 44px; border-radius: 50%;
    border: 1px solid rgba(201,169,110,0.45); background: rgba(14,9,5,0.55);
    backdrop-filter: blur(10px); color: #c9a96e; font-size: 1.1rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: border-color 0.2s, background 0.2s;
}
.btn-back:hover { border-color: #c9a96e; background: rgba(40,25,10,0.75); }

/* Page Décors & Options */
.page-header { width: 100%; max-width: 520px; display: flex; flex-direction: column; align-items: center; padding-top: 70px; padding-bottom: 12px; gap: 8px; }
.page-title { font-family: var(--f-heading); font-size: clamp(0.85rem, 2vw, 1.1rem); letter-spacing: 0.35em; text-transform: uppercase; color: #2b1c0e; }
#s-credits .page-title { color: #e8d9b8; }
.section-label { font-family: var(--f-heading); font-size: 0.85rem; font-weight: bold; letter-spacing: 0.3em; text-transform: uppercase; color: #e7ba80; margin: 22px 0 8px; text-align: center; text-shadow: 0 2px 6px rgba(0,0,0,0.8); }

.opt-row {
    display: flex; align-items: stretch; width: 100%; max-width: 420px;
    border: 1px solid rgba(100,65,25,0.4); border-radius: 3px; overflow: hidden;
    margin-bottom: 10px; background: linear-gradient(135deg, rgba(200,175,130,0.35), rgba(220,195,150,0.22));
}
.opt-row-label { flex: 1; padding: 13px 18px; font-size: 1.1rem; font-weight: bold; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.5); border-right: 1px solid rgba(100,65,25,0.3); display: flex; align-items: center; }
.opt-choices { display: flex; }
.c-btn {
    padding: 13px 22px; font-family: var(--f-heading); font-size: 0.72rem; letter-spacing: 0.08em;
    color: rgba(50,30,10,0.45); background: transparent; border: none; cursor: pointer; transition: background 0.18s, color 0.18s;
}
.c-btn.on { background: linear-gradient(135deg, #7a5530, #a57042); color: #f0debb; box-shadow: inset 0 1px 0 rgba(255,255,255,0.12); }
.c-btn:not(.on):hover { background: rgba(100,65,25,0.18); color: #2b1c0e; }
.opts-bottom { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 60px; width: 100%; }

/* --- Audio Mixer (Mélangeur) --- */
.audio-mixer { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.mixer-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; background: rgba(20,15,10,0.6); border: 1px solid rgba(100,65,25,0.4); border-radius: 6px; backdrop-filter: blur(4px); }
.mixer-label { flex: 0 0 120px; font-size: 0.95rem; font-weight: bold; color: #e7ba80; text-shadow: 0 1px 3px rgba(0,0,0,0.8); display: flex; align-items: center; gap: 6px; }
.mixer-track { flex: 1; display: flex; align-items: center; gap: 12px; }
.mixer-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; background: rgba(50,30,15,0.8); border-radius: 3px; outline: none; cursor: pointer; border: 1px solid rgba(231,186,128,0.2); }
.mixer-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #e7ba80; cursor: pointer; box-shadow: 0 0 8px rgba(231,186,128,0.6); border: 2px solid #fff; transition: transform 0.2s; }
.mixer-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.mixer-slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #e7ba80; cursor: pointer; box-shadow: 0 0 8px rgba(231,186,128,0.6); border: 2px solid #fff; transition: transform 0.2s; }
.mixer-slider::-moz-range-thumb:hover { transform: scale(1.2); }
.mixer-val { width: 45px; text-align: right; font-family: monospace; font-size: 0.85rem; color: rgba(255,255,255,0.7); }

/* Crédits */
.credits-container { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 24px 60px; width: 100%; max-width: 600px; align-self: center; }
.cr-person { text-align: center; margin: 20px 0; }
.cr-name { font-family: var(--f-heading); font-size: clamp(1rem, 2.5vw, 1.25rem); letter-spacing: 0.1em; color: #c9a96e; margin-bottom: 8px; }
.cr-roles { font-size: clamp(0.8rem, 1.8vw, 0.95rem); font-weight: 300; font-style: italic; line-height: 1.75; color: rgba(232,217,184,0.8); }
.cr-sep { width: 100%; max-width: 280px; height: 1px; background: linear-gradient(to right, transparent, rgba(201,169,110,0.35), transparent); border: none; margin: 8px 0; }

/* ==========================================================================
   IN-GAME HUD
   ========================================================================== */
#c-hud {
    position: fixed; inset: 0; z-index: 1000;
    pointer-events: none;
    display: none; /* Controled by JS */
}

/* --- Watermark Logo Traca --- */
.hud-watermark {
    position: absolute; bottom: 1.5rem; left: 1.5rem;
    width: 110px; height: 110px; object-fit: contain;
    opacity: 0.25; pointer-events: none;
    filter: drop-shadow(0 0 8px rgba(231,186,128,0.3)) brightness(0) invert(1);
    transition: opacity 0.3s;
}
.hud-watermark:hover { opacity: 0.6; }

/* --- Contrôles HUD (Haut Droite) --- */
.hud-controls {
    position: absolute; top: 1.5rem; right: 1.5rem;
    display: flex; gap: 10px; align-items: center;
    pointer-events: auto;
}
.hud-icon-btn {
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(10,10,9,0.7); border: 1px solid var(--c-border);
    color: var(--c-gold-dim); font-size: 1.2rem;
    cursor: pointer; transition: all 0.3s;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(8px); pointer-events: auto;
}
.hud-icon-btn:hover { border-color: var(--c-gold); background: rgba(231,186,128,0.15); }

.c-hud-btn {
    pointer-events: auto;
    background: rgba(10,10,9,0.75); border: 1px solid var(--c-border); color: var(--c-gold-dim);
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    cursor: pointer; transition: 0.3s;
    font-family: var(--f-heading); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em;
    padding: 0.7rem 1.2rem; border-radius: 30px; backdrop-filter: blur(8px);
}
.c-hud-btn:hover { border-color: var(--c-gold); color: var(--c-gold); background: rgba(231,186,128,0.12); }
.btn-danger { border-color: rgba(239, 68, 68, 0.5); color: var(--c-danger); }
.btn-danger:hover { background: rgba(239,68,68,0.15) !important; border-color: var(--c-danger) !important; box-shadow: 0 0 15px rgba(239,68,68,0.3); }

/* ════════════════════════════════════════════════════════
   BOUTON TIME TRAVEL (Haut Centre)
   ════════════════════════════════════════════════════════ */
#time-flash {
    position: fixed; inset: 0; z-index: 9998;
    background: #000;   /* Noir pur =  fondu cinématique authentique */
    pointer-events: none; opacity: 0;
    /* La transition est contrôlée directement par JS pour un timing précis */
}

.tt-btn {
    position: absolute; top: 1.5rem; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    cursor: pointer; pointer-events: auto;
    transition: transform 0.3s ease;
}
.tt-btn:hover { transform: translateX(-50%) scale(1.05); }

.tt-inner {
    display: flex; align-items: center; gap: 0;
    background: rgba(8, 7, 5, 0.65);
    border: 1px solid rgba(231,186,128,0.35);
    border-radius: 100px;
    padding: 8px 14px;
    backdrop-filter: blur(12px);
    box-shadow:
        0 4px 20px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.08),
        0 0 0 1px rgba(231,186,128,0.1);
    transition: all 0.4s ease;
}
.tt-btn:hover .tt-inner {
    border-color: rgba(231,186,128,0.6);
    box-shadow:
        0 8px 30px rgba(0,0,0,0.6),
        inset 0 1px 0 rgba(255,255,255,0.12),
        0 0 20px rgba(231,186,128,0.2);
}

.tt-icon-day, .tt-icon-night {
    font-size: 1.1rem; line-height: 1;
    transition: all 0.4s ease;
    width: 28px; text-align: center;
}
.tt-icon-day svg, .tt-icon-night svg { display: block; }

/* Active = l'icône du mode actuel brille, l'autre s'atténue */
.tt-btn.is-day .tt-icon-day  { opacity: 1; color: #ffd060; filter: drop-shadow(0 0 6px rgba(255,200,50,0.9)); }
.tt-btn.is-day .tt-icon-night { opacity: 0.3; color: var(--c-gold-dim); }
.tt-btn.is-night .tt-icon-night { opacity: 1; color: #a8c8ff; filter: drop-shadow(0 0 6px rgba(150,200,255,0.9)); }
.tt-btn.is-night .tt-icon-day  { opacity: 0.3; color: var(--c-gold-dim); }

.tt-divider {
    width: 1px; height: 18px; margin: 0 8px;
    background: linear-gradient(to bottom, transparent, rgba(231,186,128,0.4), transparent);
}

.tt-label {
    font-family: var(--f-heading); font-size: 0.6rem;
    letter-spacing: 0.2em; text-transform: uppercase;
    color: rgba(231,186,128,0.5);
    transition: color 0.4s;
}
.tt-btn:hover .tt-label { color: rgba(231,186,128,0.9); }

/* Night mode global tint on #c-hud */
#c-hud.night-mode::after {
    content: '';
    position: fixed; inset: 0;
    background: linear-gradient(to bottom, rgba(10,15,40,0.15) 0%, transparent 50%, rgba(10,15,40,0.25) 100%);
    pointer-events: none; z-index: -1;
    animation: nightTint 1s ease forwards;
}
@keyframes nightTint { from { opacity: 0; } to { opacity: 1; } }

/* HUD mute icon swap */
#btn-hud-mute .icon-vol-on, #btn-hud-mute .icon-vol-off { display: block; }
#btn-hud-mute.is-muted .icon-vol-on { display: none; }
#btn-hud-mute.is-muted .icon-vol-off { display: block !important; }

/* ==========================================================================
   POI COMPASS - Guide Narratif
   ========================================================================== */
.poi-compass {
    position: absolute;
    /* Positionné dynamiquement par JS (gauche / droite / haut / bas) */
    left: 50%; top: 50%; transform: translate(-50%, -50%);
    display: flex; align-items: center; justify-content: center;
    background: rgba(8, 7, 5, 0.85);
    border: 1px solid rgba(231,186,128,0.7);
    border-radius: 50%; width: 44px; height: 44px;
    backdrop-filter: blur(10px);
    pointer-events: none;
    animation: compass-pulse 1s ease-in-out infinite;
    z-index: 1001;
    box-shadow: 0 0 15px rgba(231,186,128,0.3);
}
.poi-compass-arrow {
    color: var(--c-gold);
    transition: transform 0.2s ease; /* Rotation gérée par JS */
    display: flex; align-items: center;
}
@keyframes compass-pulse {
    0%, 100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 10px rgba(231,186,128,0.2); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); box-shadow: 0 0 25px rgba(231,186,128,0.8); }
}

/* ==========================================================================
   PANNEAU ÉDITEUR (SPLIT LAYOUT)
   ========================================================================== */
#c-editor { position: fixed; right: 1.5rem; top: 1.5rem; bottom: 1.5rem; width: 680px; max-width: calc(100vw - 3rem); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 8px; z-index: 4000; display: flex; flex-direction: column; overflow: hidden; box-shadow: -10px 0 40px rgba(0,0,0,0.5); pointer-events: auto; }
.ced-header { display: flex; justify-content: space-between; align-items: center; padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--c-border); background: var(--c-bg); }
.ced-title { font-family: var(--f-heading); color: var(--c-gold); font-size: 1rem; letter-spacing: 0.1em; text-transform: uppercase; }
.ced-header .c-hud-btn { position: static; padding: 0.5rem 1rem; border-radius: 4px; }

.ced-body { display: flex; flex: 1; overflow: hidden; }

/* Colonne Liste (Gauche) */
.ced-list-col { width: 40%; border-right: 1px solid var(--c-border); display: flex; flex-direction: column; background: rgba(0,0,0,0.3); }
.ced-list-toolbar { padding: 1rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--c-border); }
.ced-col-title { font-size: 0.75rem; font-family: var(--f-heading); color: var(--c-gold-dim); text-transform: uppercase; letter-spacing: 0.1em; }
#poi-list { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; }
.poi-item { padding: 1rem; border-bottom: 1px solid rgba(255,255,255,0.05); cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 0.8rem; }
.poi-item:hover, .poi-item.selected { background: rgba(231,186,128,0.1); }
.poi-item.selected { border-left: 3px solid var(--c-gold); }
.poi-item-tit { font-family: sans-serif; font-size: 0.85rem; color: #fff; font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poi-item-badge { background: var(--c-gold); color: #000; font-size: 0.6rem; padding: 0.1rem 0.4rem; border-radius: 10px; font-weight: bold; }
.poi-empty { padding: 2rem; text-align: center; font-size: 0.85rem; color: rgba(255,255,255,0.4); font-style: italic; line-height: 1.5; }

/* Colonne Form (Droite) */
.ced-form-col { width: 60%; padding: 1.5rem; overflow-y: auto; position: relative; }
.ced-form-hint { background: rgba(74, 222, 128, 0.1); border: 1px dashed #4ade80; color: #4ade80; padding: 1rem; text-align: center; font-size: 0.85rem; border-radius: 6px; margin-bottom: 1.5rem; animation: pulse-green 1s infinite alternate; }
@keyframes pulse-green { from { opacity: 0.6; } to { opacity: 1; } }

.ced-field { margin-bottom: 1.2rem; }
.ced-field label { display: block; font-family: sans-serif; font-size: 0.7rem; color: var(--c-gold-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; font-weight: bold; }
.ced-field input[type=text], .ced-field textarea, .ced-field select { width: 100%; background: rgba(0,0,0,0.5); border: 1px solid var(--c-border); color: #fff; padding: 0.8rem; border-radius: 4px; font-family: sans-serif; font-size: 0.9rem; outline: none; transition: 0.2s; }
.ced-field input:focus, .ced-field textarea:focus, .ced-field select:focus { border-color: var(--c-gold); box-shadow: 0 0 10px rgba(231,186,128,0.2); }
.ced-hint-small { display: block; font-size: 0.7rem; color: rgba(255,255,255,0.4); margin-top: 0.4rem; font-style: italic; }

.ced-form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 2rem; border-top: 1px solid var(--c-border); padding-top: 1.5rem; }
.ced-form-actions .c-btn { flex: 1 1 calc(50% - 0.5rem); }

/* Footer */
.ced-header { 
    padding: 1rem 1.5rem; 
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex; justify-content: space-between; align-items: center; 
}
.ced-tabs { display: flex; gap: 10px; }
.ced-tabs .tab-btn { background: rgba(255,255,255,0.05); color: #aaa; border: 1px solid transparent; }
.ced-tabs .tab-btn:hover { background: rgba(255,255,255,0.1); }
.ced-tabs .tab-btn.active { 
    background: rgba(231,186,128,0.15); 
    color: var(--c-gold); 
    border-color: rgba(231,186,128,0.4); 
}

.ced-title { font-family: var(--f-heading); font-size: 1.2rem; margin: 0;}
.ced-body { display: flex; flex: 1; min-height: 0; }
.tab-content { display: none !important; }
.tab-content.active { display: flex !important; flex: 1; min-height: 0; }

/* ==========================================================================
   CSS2D POI & POPUPS (Affichés sur le Canvas)
   ========================================================================== */
.poi-wrapper { pointer-events: auto; } /* Reactive area */

.poi-marker {
    width: 18px; height: 18px;
    background: radial-gradient(circle at 30% 30%, #fff 0%, var(--c-gold) 40%, #000 100%);
    border: 2px solid rgba(255,255,255,0.5); border-radius: 50%;
    cursor: pointer; position: relative;
    box-shadow: 0 0 15px rgba(231,186,128,0.6);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.poi-marker.type-object {
    background: radial-gradient(circle at 30% 30%, #fff 0%, #4ade80 40%, #000 100%);
    box-shadow: 0 0 15px rgba(74,222,128,0.6);
}
.poi-marker.type-character {
    background: radial-gradient(circle at 30% 30%, #fff 0%, #ffd700 40%, #000 100%);
    box-shadow: 0 0 15px rgba(255,215,0,0.6);
}
.c-poi {
    width: 24px; height: 24px;
    background: rgba(231, 186, 128, 0.4);
    border: 2px solid var(--c-gold);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(231,186,128,0.5);
    transition: transform 0.2s;
    pointer-events: auto;
}
.c-poi:hover { transform: scale(1.2); }

.c-audio-node {
    width: 28px; height: 28px;
    background: rgba(100, 180, 255, 0.4);
    border: 2px solid #64b4ff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(100,180,255,0.5);
    transition: transform 0.2s;
    pointer-events: auto;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: white;
}
.c-audio-node::after { content: '🎵'; }
.c-audio-node:hover { transform: scale(1.2); }
.poi-marker::after {
    content: ''; position: absolute; inset: -6px; border: 1px solid var(--c-gold); border-radius: 50%;
    animation: ripple 2s infinite linear; opacity: 0;
}
.poi-marker:hover { transform: scale(1.3); border-color: #fff; }
.poi-marker:hover::after { animation: none; opacity: 1; border-color: #fff; }

.poi-marker.editor-active { background: #4ade80; box-shadow: 0 0 30px #4ade80; border-color: #fff; transform: scale(1.4); }

@keyframes ripple { 0% { transform: scale(0.5); opacity: 1; } 100% { transform: scale(2); opacity: 0; } }

/* Popup In-Game */
.poi-popup {
    position: absolute; left: 20px; top: -100px;
    background: var(--c-surface); border-left: 3px solid var(--c-gold);
    width: 320px; padding: 1.5rem; box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    opacity: 0; transform: translateX(20px) scale(0.95); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none; border-radius: 0 8px 8px 0;
}
.poi-popup.visible { opacity: 1; transform: translateX(20px) scale(1); pointer-events: auto; }
.poi-pop-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.8rem; }
.poi-pop-title { margin: 0; font-family: var(--f-heading); color: var(--c-gold); font-size: 1.3rem; line-height: 1.2; }
.poi-pop-close { background: none; border: none; color: #fff; font-size: 1.2rem; cursor: pointer; opacity: 0.5; padding: 0 0 0 1rem; transition: 0.2s; }
.poi-pop-close:hover { opacity: 1; color: var(--c-danger); }
.poi-pop-desc { margin: 0; font-family: sans-serif; font-size: 0.95rem; line-height: 1.6; color: rgba(255,255,255,0.8); }

.poi-pop-caption {
    display: none;
    margin-top: 1rem;
    padding: 0.8rem 1rem;
    background: rgba(0, 0, 0, 0.45);
    border-left: 2px solid rgba(231, 186, 128, 0.5);
    border-radius: 4px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #fff;
    font-style: italic;
    min-height: 3em;
    transition: all 0.3s ease;
    overflow-y: auto;
    max-height: 180px; /* Brider pour éviter l'explosion de l'UI si texte géant */
    /* L'expansion se fait par le bas naturellement car le parent est en top:-100px ou relatif */
}

.poi-pop-caption span {
    display: inline-block;
    margin-right: 4px;
    will-change: opacity, transform;
}

/* Equalizer Anim (Narration playing) */
.poi-pop-audio { display: flex; align-items: center; gap: 0.5rem; margin-top: 1rem; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 1rem; font-family: sans-serif; font-size: 0.8rem; color: var(--c-gold-dim); }
.eq-bars { display: flex; gap: 2px; height: 12px; align-items: flex-end; }
.eq-bar { width: 3px; background: var(--c-gold); animation: eq 0.5s infinite alternate; }
.eq-bar:nth-child(2) { animation-delay: 0.2s; }
.eq-bar:nth-child(3) { animation-delay: 0.4s; }
@keyframes eq { 0% { height: 20%; } 100% { height: 100%; } }

/* ==========================================================================
   RESPONSIVE MOBILE (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
    /* --- Menu --- */
    .c-title { font-size: 2.2rem; }
    .c-subtitle { font-size: 0.95rem; margin-bottom: 2rem; }
    .c-eyebrow { font-size: 0.65rem; }
    .c-menu-logo { width: 80px; height: 80px; }
    .c-btn { padding: 0.9rem 1.5rem; font-size: 0.78rem; }
    .c-menu-nav { max-width: 90vw; }
    .c-screen { padding: 1.2rem; }

    /* --- HUD --- */
    .hud-watermark { width: 70px; height: 70px; bottom: 1rem; left: 1rem; }
    .tt-btn { top: 0.8rem; }
    .tt-inner { padding: 6px 10px; }
    .tt-label { font-size: 0.5rem; }
    .tt-icon-day svg, .tt-icon-night svg { width: 16px; height: 16px; }
    .hud-controls { top: 0.8rem; right: 0.8rem; gap: 6px; }
    .hud-icon-btn { width: 38px; height: 38px; }
    .c-hud-btn { font-size: 0.62rem; padding: 0.5rem 0.8rem; }

    /* --- POI Popup --- */
    .poi-popup {
        width: 85vw;
        max-width: 320px;
        padding: 1.2rem;
        top: -90px;
        left: 50%;
        transform: translateX(-50%) scale(0.95);
        border-radius: 8px;
        border-left: none;
        border-top: 3px solid var(--c-gold);
    }
    .poi-popup.visible {
        transform: translateX(-50%) scale(1);
    }
    .poi-pop-title { font-size: 1.1rem; }
    .poi-pop-desc { font-size: 0.9rem; }

    /* --- Loader --- */
    .c-loader-logo { width: 90px; height: 90px; }
}

/* ==========================================================================
   CARTE AÉRIENNE (MAP VIEW) POIs
   ========================================================================== */

.map-poi-wrap {
    position: relative;
    cursor: pointer;
    text-align: center;
    transition: transform 0.3s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.map-poi-wrap:hover {
    transform: scale(1.15);
}

.map-poi {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin: 0 auto 8px auto;
    background: #555;
    border: 2px solid #888;
    position: relative;
    transition: all 0.3s ease;
}

.map-poi.active {
    background: var(--c-gold);
    border: 2px solid #fff;
    box-shadow: 0 0 15px var(--c-gold), inset 0 0 5px #fff;
}

.map-poi.locked {
    background: #333;
    border: 2px solid #555;
    opacity: 0.7;
}

.map-poi-wrap:hover .map-poi.active {
    box-shadow: 0 0 25px var(--c-gold), inset 0 0 10px #fff;
}

.map-poi-glow {
    position: absolute;
    top: 50%; left: 50%;
    width: 100%; height: 100%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: var(--c-gold);
    opacity: 0.5;
    filter: blur(10px);
    animation: map-pulse 2s infinite ease-in-out;
}

@keyframes map-pulse {
    0%   { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
    50%  { transform: translate(-50%, -50%) scale(2); opacity: 0.1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
}

.map-poi-label {
    font-family: var(--f-heading);
    color: #fff;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    opacity: 0.8;
    background: rgba(0,0,0,0.4);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.map-poi.active + .map-poi-label {
    color: var(--c-gold);
    opacity: 1;
}

/* ==========================================================================
   MOBILE & RESPONSIVENESS
   ========================================================================== */
.menu-video-bg {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; z-index: 0; opacity: 1; pointer-events: none;
}

.menu-title-responsive {
    white-space: nowrap;
    font-family: var(--f-heading);
    font-weight: bold;
    color: #e7ba80;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin: 0;
    text-align: center;
    text-shadow: 0 4px 10px rgba(0,0,0,0.9), 0 0 25px rgba(231,186,128,0.3);
    -webkit-text-stroke: 0.3px rgba(0,0,0,0.4);
    font-size: 18px; /* Desktop */
}

@media (max-width: 768px) {
    .menu-video-bg {
        /* Plus de bricolages de scale : le mobile charge sa propre vidéo en 9:16 natif (bg_menu_mobile.mp4) */
        object-fit: cover !important;
        width: 100%;
        left: 0;
        transform: none;
    }
    
    .menu-title-responsive {
        font-size: 11px !important; /* Mobile exact safe size */
        letter-spacing: 0.08em;
    }
    .menu-sub { font-size: 1.6rem !important; }
    .hud-controls { gap: 6px; top: 1rem; right: 1rem; }
    .hud-icon-btn { width: 36px; height: 36px; font-size: 1rem; }
    #btn-hud-back-map { top: 1rem !important; left: 1rem !important; padding: 6px 10px !important; }
    
    #c-editor { width: auto; left: 1rem; right: 1rem; top: 1rem; bottom: 1rem; }
    .ced-body { flex-direction: column; }
    .ced-list-col { width: 100%; height: 40%; border-right: none; border-bottom: 1px solid var(--c-border); }
    .ced-form-col { width: 100%; height: 60%; }
    
    .poi-popup { padding: 1rem; max-width: 280px; }
    .poi-pop-title { font-size: 1.1rem; }
    .poi-pop-desc { font-size: 0.8rem; }
    .poi-pop-caption { font-size: 0.75rem; }
}

/* ── BOUSSOLE HORS-CHAMP (POI TRACKER) ── */
.poi-compass {
    position: fixed;
    width: 48px;
    height: 48px;
    background: rgba(10,5,2, 0.7);
    border: 1px solid rgba(231,186,128, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(-50%, -50%);
    z-index: 999;
    pointer-events: none;
    box-shadow: 0 0 15px rgba(231,186,128,0.3);
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}
.poi-compass-arrow {
    color: #e7ba80;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center;
    transition: transform 0.1s linear;
}

/* ── ÉDITEUR UI POLISH (V7) ── */
.ced-field input, .ced-field select, .ced-field textarea {
    padding: 10px 14px;
    background: rgba(15, 10, 5, 0.8);
    border: 1px solid rgba(231,186,128,0.3);
    border-radius: 6px;
    color: #fff;
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.2s, background 0.2s;
    width: 100%;
    margin-top: 4px;
}

.ced-field input:focus, .ced-field select:focus, .ced-field textarea:focus {
    border-color: #e7ba80;
    background: rgba(20, 15, 10, 0.95);
    outline: none;
}

.ced-field label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.7);
    font-weight: 600;
}

.replica-box {
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.btn-rem-rep {
    opacity: 0.7;
    transition: opacity 0.2s, background 0.2s;
}

.btn-rem-rep:hover {
    opacity: 1;
    background: #d32f2f;
}

/* ══════════════════════════════════════════════════════════
   MÉLANGEUR AUDIO (Options Panel)
══════════════════════════════════════════════════════════ */
.audio-mixer {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px 0;
}

.mixer-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mixer-label {
    font-family: var(--f-body);
    font-size: 0.9rem;
    color: rgba(231, 186, 128, 0.8);
    min-width: 110px;
    flex-shrink: 0;
}

.mixer-track {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.mixer-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: rgba(231, 186, 128, 0.15);
    outline: none;
    cursor: pointer;
    accent-color: var(--c-gold);
}

.mixer-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--c-gold);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(231, 186, 128, 0.5);
    transition: transform 0.15s;
}

.mixer-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.mixer-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--c-gold);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 6px rgba(231, 186, 128, 0.5);
}

.mixer-val {
    font-family: var(--f-heading);
    font-size: 0.7rem;
    color: var(--c-gold);
    min-width: 38px;
    text-align: right;
    letter-spacing: 0.05em;
}

/* Mobile mixer */
@media (max-width: 480px) {
    .mixer-row { flex-wrap: wrap; gap: 6px; }
    .mixer-label { min-width: 90px; font-size: 0.8rem; }
}

