/* =============================================================================
   Backroom — Styles specifiques au jeu (depuis modele.html)
   ============================================================================= */

/* --- VIGNETTE --- */
#vignette {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, transparent 40%, rgba(0,0,0,0.85) 100%);
    pointer-events: none; transition: background 0.3s ease; z-index: 10;
}
.vignette-run { background: radial-gradient(circle, transparent 20%, rgba(0,0,0,0.98) 95%) !important; }

/* --- UI LAYER --- */
#ui-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; display: flex; flex-direction: column;
    justify-content: center; align-items: center; z-index: 30;
}

/* --- CANVAS CONTAINER --- */
#canvas-container { width: 100vw; height: 100vh; display: block; }

/* --- INSTRUCTIONS --- */
#instructions {
    background: rgba(30, 28, 25, 0.85); color: #d4cbb8; padding: 30px; border-radius: 4px;
    text-align: center; pointer-events: auto; cursor: pointer; border: 2px solid #6b6254;
    box-shadow: 0 0 15px rgba(0,0,0,0.8), inset 0 0 20px rgba(0,0,0,0.8); text-transform: uppercase;
}
#instructions h2 { color: #a19582; border-bottom: 1px solid #4a433a; padding-bottom: 10px; margin-top: 0; }

/* --- CROSSHAIR --- */
#crosshair {
    position: absolute; top: 50%; left: 50%; width: 6px; height: 6px;
    background: rgba(200, 190, 170, 0.5); transform: translate(-50%, -50%);
    border-radius: 50%; z-index: 15; transition: all 0.2s;
}
.active-crosshair { background: rgba(255, 50, 50, 0.9) !important; transform: translate(-50%, -50%) scale(2) !important; }
.hidden { display: none !important; }

/* --- GRAIN OVERLAY --- */
#grain-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; opacity: 0.12;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    z-index: 5;
}

/* --- TIME DISPLAY --- */
#time-display { position: absolute; top: 10px; right: 10px; font-size: 16px; font-weight: bold; color: #d4cbb8; letter-spacing: 2px; z-index: 20; pointer-events: none; font-family: 'Courier New', Courier, monospace; }

/* --- HUD SURVIE (intégré dans le GameHeader React) --- */
#hud-bottom {
    transition: all 0.3s ease;
}
.hud-box {
    background: rgba(35, 32, 28, 0.75); border: 2px solid rgba(107, 98, 84, 0.6); border-radius: 4px;
    padding: 10px 15px; display: flex; align-items: center; gap: 12px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.6), inset 0 0 10px rgba(0,0,0,0.8); backdrop-filter: blur(3px); position: relative;
}
.hud-box-center { flex-direction: column; gap: 5px; padding: 8px 20px; }
.hud-icon svg { width: 24px; height: 24px; fill: #a19582; filter: drop-shadow(1px 1px 2px #000); transition: fill 0.3s; }

/* --- RECHARGE BATTERIE --- */
#hud-battery { pointer-events: auto; cursor: pointer; }
@keyframes battery-shake { 0%, 100% { transform: translateX(0) rotate(0deg); } 25% { transform: translateX(-2px) rotate(-15deg); } 75% { transform: translateX(2px) rotate(15deg); } }
.battery-shake { animation: battery-shake 0.3s infinite; }
#recharge-ring { position: absolute; top: -4px; left: -4px; width: 32px; height: 32px; transform: rotate(-90deg); pointer-events: none; }
#recharge-ring circle { transition: stroke-dashoffset 0.1s; }

/* --- BARRES --- */
.bar-bg { width: 140px; height: 12px; background: rgba(15, 14, 12, 0.9); border: 1px solid #4a433a; border-radius: 2px; overflow: hidden; box-shadow: inset 0 2px 5px rgba(0,0,0,0.8); }
.bar-fill { height: 100%; background: #7c8567; transition: width 0.1s, background-color 0.3s; }
.bar-fill.stamina { background: #677885; }

/* --- WHISTLE --- */
#whistle-indicator { font-size: 14px; font-weight: bold; color: #8c8270; text-align: center; letter-spacing: 1px; transition: color 0.2s; }

/* --- EMF (mobile / taille par défaut) --- */
#hud-emf { flex-direction: column; gap: 5px; }
#emf-dial {
    width: 110px; height: 55px; background: radial-gradient(circle at bottom, rgba(70,65,55,0.8) 0%, rgba(30,28,25,0.9) 100%);
    border-top-left-radius: 55px; border-top-right-radius: 55px; position: relative; border: 2px solid #6b6254; border-bottom: 2px solid #2a2722;
    margin-bottom: 2px; overflow: hidden; box-shadow: inset 0 0 15px rgba(0,0,0,0.9);
}
#emf-dial::before {
    content: ''; position: absolute; width: 100%; height: 100%;
    background: conic-gradient(from -90deg at 50% 100%, transparent 40deg, #a19582 41deg, transparent 42deg, transparent 65deg, #a19582 66deg, transparent 67deg, transparent 90deg, #a19582 91deg, transparent 92deg, transparent 115deg, #a19582 116deg, transparent 117deg, transparent 138deg, #a19582 139deg, transparent 140deg); opacity: 0.3;
}
#emf-needle { position: absolute; bottom: -2px; left: calc(50% - 1.5px); width: 3px; height: 50px; background: #a83232; transform-origin: bottom center; transform: rotate(-75deg); transition: transform 0.1s; border-radius: 2px; box-shadow: 1px 1px 2px rgba(0,0,0,0.8); z-index: 2; }
#mic-needle { position: absolute; bottom: -2px; left: calc(50% - 1px); width: 2px; height: 42px; background: #d4cbb8; transform-origin: bottom center; transform: rotate(-75deg); transition: transform 0.05s; border-radius: 2px; box-shadow: 1px 1px 2px rgba(0,0,0,0.8); z-index: 1; }
.emf-label { font-size: 12px; font-weight: bold; color: #a19582; letter-spacing: 2px; }

/* --- EMF desktop (x2) --- */
.emf-dial-desktop {
    width: 220px; height: 110px; background: radial-gradient(circle at bottom, rgba(70,65,55,0.8) 0%, rgba(30,28,25,0.9) 100%);
    border-top-left-radius: 110px; border-top-right-radius: 110px; position: relative; border: 2px solid #6b6254; border-bottom: 2px solid #2a2722;
    margin-bottom: 3px; overflow: hidden; box-shadow: inset 0 0 20px rgba(0,0,0,0.9);
}
.emf-dial-desktop::before {
    content: ''; position: absolute; width: 100%; height: 100%;
    background: conic-gradient(from -90deg at 50% 100%, transparent 40deg, #a19582 41deg, transparent 42deg, transparent 65deg, #a19582 66deg, transparent 67deg, transparent 90deg, #a19582 91deg, transparent 92deg, transparent 115deg, #a19582 116deg, transparent 117deg, transparent 138deg, #a19582 139deg, transparent 140deg); opacity: 0.3;
}
.emf-needle-desktop { position: absolute; bottom: -2px; left: calc(50% - 2px); width: 5px; height: 100px; background: #a83232; transform-origin: bottom center; transform: rotate(-75deg); transition: transform 0.1s; border-radius: 3px; box-shadow: 2px 2px 4px rgba(0,0,0,0.8); z-index: 2; }
.mic-needle-desktop { position: absolute; bottom: -2px; left: calc(50% - 1.5px); width: 3px; height: 84px; background: #d4cbb8; transform-origin: bottom center; transform: rotate(-75deg); transition: transform 0.05s; border-radius: 3px; box-shadow: 2px 2px 4px rgba(0,0,0,0.8); z-index: 1; }

/* --- CONTROLES MOBILES --- */
#mobile-controls { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 20; pointer-events: none; }
#joystick-zone { position: absolute; bottom: 30px; left: 30px; width: 130px; height: 130px; background: rgba(35, 32, 28, 0.4); border-radius: 50%; border: 2px solid rgba(107, 98, 84, 0.4); pointer-events: auto; touch-action: none; box-shadow: inset 0 0 20px rgba(0,0,0,0.5); }
#joystick-thumb { position: absolute; top: 50%; left: 50%; width: 50px; height: 50px; background: rgba(161, 149, 130, 0.6); border-radius: 50%; box-shadow: 0 5px 10px rgba(0,0,0,0.5); transform: translate(-50%, -50%); pointer-events: none; }
#action-buttons {
    position: absolute; bottom: 30px; right: 20px; display: grid; grid-template-columns: repeat(3, 60px); grid-template-rows: repeat(2, 60px);
    grid-template-areas: "interact . whistle" "sprint crouch flash"; gap: 15px; pointer-events: none;
}
#btn-interact { grid-area: interact; } #btn-whistle { grid-area: whistle; }
#btn-sprint { grid-area: sprint; } #btn-crouch { grid-area: crouch; } #btn-flash { grid-area: flash; }

.action-btn {
    width: 100%; height: 100%; background: rgba(35, 32, 28, 0.75); border: 2px solid rgba(107, 98, 84, 0.6); border-radius: 50%;
    display: flex; justify-content: center; align-items: center; touch-action: none; user-select: none; pointer-events: auto;
    box-shadow: 0 5px 10px rgba(0,0,0,0.6), inset 0 0 10px rgba(0,0,0,0.8); transition: transform 0.1s, background 0.2s, border-color 0.2s;
}
.action-btn svg { width: 30px; height: 30px; fill: #d4cbb8; pointer-events: none; filter: drop-shadow(1px 1px 2px #000); }
.action-btn.active { background: rgba(168, 50, 50, 0.75); border-color: #a83232; transform: scale(0.9); }

/* --- ECRAN DE MORT --- */
#blood-container {
    position: absolute; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 40; pointer-events: none; opacity: 0; transition: opacity 0.5s;
    filter: url(#goo);
}
#blood-canvas { width: 100%; height: 100%; display: block; }

#death-text {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    display: flex; flex-direction: column; align-items: center; gap: 30px;
    z-index: 50; pointer-events: none; opacity: 0; transition: opacity 1.5s ease 1.5s;
}
#death-text.active { opacity: 1; pointer-events: auto; }
#death-text h1 {
    color: #ff0000; font-size: 6vh; font-weight: bold; margin: 0; text-align: center;
    text-shadow: 2px 2px 10px #000, 0 0 30px #500;
}
.death-btn {
    background: rgba(100, 10, 10, 0.9); color: #d4cbb8; border: 2px solid #ff4444; border-radius: 8px;
    padding: 15px 40px; font-size: 2.5vh; font-weight: bold; cursor: pointer; text-transform: uppercase;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5), inset 0 0 10px rgba(0,0,0,0.8); transition: all 0.2s;
}
.death-btn:hover { background: rgba(150, 15, 15, 1); transform: scale(1.05); box-shadow: 0 0 30px rgba(255, 0, 0, 0.8); color: #fff; }

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 768px) {
    #hud-bottom { align-items: flex-start; }
    #hud-battery, #hud-stamina { padding: 6px 10px; gap: 8px; }
    .bar-bg { width: 90px; height: 8px; }
    .hud-icon svg { width: 18px; height: 18px; }
    #hud-emf { transform: scale(0.8); transform-origin: top right; }
    .hud-box-center { display: none; }
    #instructions { transform: scale(0.85); width: 85%; padding: 20px; }
}
