:root {
    --bg-gradient: radial-gradient(circle at center, #2b1055 0%, #15062c 60%, #080112 100%);
    --card-bg: rgba(255, 255, 255, 0.08);
    --card-border: rgba(255, 255, 255, 0.18);
    --primary-color: #ff3377;
    --primary-glow: rgba(255, 51, 119, 0.5);
    --secondary-color: #9933ff;
    --accent-gold: #ffdf00;
    --text-color: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

body {
    background: var(--bg-gradient);
    color: var(--text-color);
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    overflow-x: hidden; position: relative; padding: 15px;
}

/* --- Halo lumineux mouvants --- */
.bg-glow {
    position: fixed; width: 400px; height: 400px;
    border-radius: 50%; filter: blur(100px); z-index: 0; pointer-events: none;
    animation: drift 15s infinite alternate ease-in-out;
}
.bg-glow-1 { background: rgba(255, 51, 119, 0.15); top: -10%; left: -10%; }
.bg-glow-2 { background: rgba(153, 51, 255, 0.15); bottom: -10%; right: -10%; animation-delay: -7s; }

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 100px) scale(1.3); }
}

/* --- Particules et Cœurs --- */
#particles-container, #floating-hearts-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0;
}
.particle { position: absolute; color: rgba(255,255,255,0.4); animation: floatUp 8s infinite linear; }
.floating-heart { position: absolute; font-size: 1.5rem; opacity: 0.6; animation: floatUpHeart 6s infinite ease-in; }

@keyframes floatUp {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    50% { opacity: 0.8; }
    100% { transform: translateY(-10vh) rotate(360deg); opacity: 0; }
}
@keyframes floatUpHeart {
    0% { transform: translateY(100vh) scale(0.5); opacity: 0; }
    50% { opacity: 0.8; transform: translateY(50vh) scale(1.2); }
    100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* --- Cartes Glassmorphism --- */
.card, .login-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border); border-radius: 24px;
    padding: 35px 25px; width: 100%; max-width: 650px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 0 15px rgba(255,255,255,0.05);
    z-index: 1; position: relative; transition: all 0.3s ease;
}
.login-card { max-width: 420px; text-align: center; }

.floating { animation: hoverEffect 3s infinite ease-in-out; display: inline-block; font-size: 2.5rem; margin-bottom: 10px; }
@keyframes hoverEffect { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

h1, h2 { color: #fff; text-shadow: 0 0 10px var(--primary-glow); margin-bottom: 15px; }
h3 { color: var(--accent-gold); margin-bottom: 10px; }
p { line-height: 1.6; color: #e8d8f0; margin-bottom: 15px; }
.text-center { text-align: center; }
.mt-2 { margin-top: 15px; } .mt-3 { margin-top: 25px; }

/* --- PAVÉ NUMÉRIQUE (DIGICODE) --- */
.numpad-display {
    background: rgba(0,0,0,0.4); border: 2px solid var(--card-border);
    border-radius: 15px; padding: 15px; margin: 20px auto;
    display: flex; justify-content: center; gap: 10px; min-height: 50px; align-items: center;
}
.dot {
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid var(--primary-color); background: transparent;
    transition: all 0.2s;
}
.dot.filled { background: var(--primary-color); box-shadow: 0 0 10px var(--primary-color); transform: scale(1.2); }

.numpad-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 12px; max-width: 280px; margin: 0 auto 15px;
}
.num-btn {
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%; width: 70px; height: 70px; font-size: 1.5rem; font-weight: bold;
    color: #fff; cursor: pointer; transition: all 0.15s; margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.num-btn:active, .num-btn:hover {
    background: var(--primary-color); border-color: var(--primary-color);
    box-shadow: 0 0 20px var(--primary-glow); transform: scale(0.95);
}
.action-btn.clear { color: #ff5555; border-color: rgba(255,85,85,0.3); }
.action-btn.valid { background: #28a745; border-color: #28a745; color: #fff; }
.action-btn.valid:hover { background: #218838; box-shadow: 0 0 20px rgba(40,167,69,0.6); }

/* --- Boutons et Inputs --- */
.btn-primary, .btn-secondary {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: #fff; border: none; padding: 14px 28px; font-size: 1.05rem; font-weight: bold;
    border-radius: 50px; cursor: pointer; box-shadow: 0 5px 20px var(--primary-glow);
    transition: all 0.3s; display: inline-block;
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(255, 51, 119, 0.8); }
.btn-secondary { background: transparent; border: 2px solid var(--card-border); box-shadow: none; font-size: 0.9rem; }
.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: #fff; }
.grand-btn { font-size: 1.2rem; padding: 16px 35px; background: linear-gradient(45deg, #ff0055, #ffcc00); }
.pulse-btn { animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* --- Navigation & Écrans --- */
.screen { display: none; opacity: 0; transition: opacity 0.6s ease-in-out; }
.screen.active { display: block; opacity: 1; }
.hidden { display: none !important; }
.error-hidden { visibility: hidden; color: #ff4466; font-weight: bold; min-height: 24px; }

/* --- Barre de progression --- */
.game-header { width: 100%; max-width: 650px; margin-bottom: 25px; z-index: 1; }
.progress-bar { background: rgba(0,0,0,0.4); height: 12px; border-radius: 10px; overflow: hidden; border: 1px solid rgba(255,255,255,0.1); }
#progress-fill { height: 100%; width: 10%; background: linear-gradient(90deg, var(--primary-color), var(--accent-gold)); transition: width 0.5s ease; box-shadow: 0 0 10px var(--primary-color); }
#level-indicator { font-size: 0.9rem; color: #ddd; font-weight: bold; margin-top: 5px; display: inline-block; }

/* --- Compte à rebours --- */
.countdown-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 30px 0; }
.time-box { background: rgba(0,0,0,0.35); padding: 18px 10px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.1); }
.time-box span { font-size: 2.2rem; font-weight: bold; color: var(--accent-gold); text-shadow: 0 0 10px rgba(255,223,0,0.4); display: block; }
.time-box small { font-size: 0.8rem; text-transform: uppercase; color: #ccc; }

/* --- Quiz & Énigmes --- */
.quiz-progress { font-size: 0.85rem; color: #bbb; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 1px; }
.options-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 20px 0; }
.option-btn {
    background: rgba(255,255,255,0.06); border: 1px solid var(--card-border);
    padding: 15px; border-radius: 12px; color: #fff; cursor: pointer;
    transition: all 0.2s; text-align: left; font-size: 1rem;
}
.option-btn:hover { background: rgba(255,255,255,0.18); transform: translateX(8px); border-color: var(--primary-color); }
.option-btn.correct { background: #28a745 !important; border-color: #28a745; box-shadow: 0 0 15px rgba(40,167,69,0.5); }
.option-btn.wrong { background: #dc3545 !important; border-color: #dc3545; opacity: 0.7; }
.riddle-box { background: rgba(0,0,0,0.3); padding: 20px; border-left: 4px solid var(--accent-gold); border-radius: 8px; margin: 20px 0; font-size: 1.1rem; font-style: italic; }
.input-group { display: flex; gap: 10px; }
.center-input { justify-content: center; max-width: 450px; margin: 0 auto; }
input[type="text"], input[type="password"], input[type="datetime-local"], textarea {
    width: 100%; padding: 14px 20px; border-radius: 50px; border: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.4); color: #fff; font-size: 1rem; outline: none;
}
textarea { border-radius: 15px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--primary-color); box-shadow: 0 0 10px var(--primary-glow); }

/* --- Finale & Machine à écrire --- */
.finale-card { border: 2px solid var(--accent-gold); box-shadow: 0 0 60px rgba(255, 223, 0, 0.25); }
.subtitle-gold { color: var(--accent-gold); font-weight: normal; margin-bottom: 25px; letter-spacing: 2px; }
.love-letter { background: rgba(0,0,0,0.35); padding: 25px; border-radius: 20px; text-align: left; margin: 20px 0; border: 1px solid rgba(255,255,255,0.1); }
.typewriter-content { font-size: 1.1rem; line-height: 1.8; min-height: 120px; white-space: pre-wrap; color: #fdfbfd; }
.photo-frame { border: 3px solid #fff; padding: 10px; background: #fff; border-radius: 15px; transform: rotate(-2deg); box-shadow: 0 10px 25px rgba(0,0,0,0.5); max-width: 350px; margin: 20px auto 0; }
.photo-placeholder { height: 200px; background: #222; color: #888; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 10px; text-align: center; padding: 10px; }
.gift-photo { width: 100%; border-radius: 10px; display: block; }
.signature { text-align: right; margin-top: 25px; font-size: 1.2rem; color: var(--accent-gold); }

/* --- Modale Admin --- */
.admin-trigger { margin-top: 25px; font-size: 0.8rem; }
.admin-trigger a { color: rgba(255,255,255,0.3); text-decoration: none; }
.admin-trigger a:hover { color: #fff; }
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 15px; }
.modal-content { max-height: 90vh; overflow-y: auto; text-align: left; }
.close-btn { float: right; font-size: 1.8rem; cursor: pointer; color: #aaa; }
.close-btn:hover { color: #fff; }

/* Responsivité Mobile */
@media (max-width: 480px) {
    .card, .login-card { padding: 25px 15px; }
    .countdown-grid { grid-template-columns: repeat(2, 1fr); }
    .num-btn { width: 60px; height: 60px; font-size: 1.3rem; }
    .input-group { flex-direction: column; }
    .input-group button { width: 100%; border-radius: 50px; }
    input[type="text"] { border-radius: 50px; }
}

/* --- Bouton Cœur Secret Invisible --- */
#secret-bypass-heart {
    position: fixed;
    bottom: 15px;
    right: 15px;
    font-size: 1.4rem;
    opacity: 0.25; /* Très discret, ressemble à une particule du décor */
    cursor: default;
    user-select: none;
    z-index: 9999;
    transition: transform 0.2s, opacity 0.2s;
    animation: floatUpHeart 6s infinite ease-in;
}
#secret-bypass-heart:active {
    transform: scale(1.5);
    opacity: 0.8;
}

/* --- Bouton Accès Administrateur --- */
.admin-trigger-container {
    position: fixed;
    bottom: 15px;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 9000;
}
.admin-trigger-btn {
    background: rgba(0, 0, 0, 0.4);
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}
.admin-trigger-btn:hover {
    background: rgba(255, 75, 114, 0.8);
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

/* --- Fenêtre Modale (Admin) --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal.hidden {
    display: none;
}
.modal-content {
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    background: #1a1528;
    border: 1px solid rgba(255, 75, 114, 0.4);
}
.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.8rem;
    color: #aaa;
    cursor: pointer;
}
.close-modal:hover {
    color: white;
}

/* --- Correctif clics bloqués --- */
#particles-container, #floating-hearts-container {
    pointer-events: none !important;
}

/* --- Bouton Accès Administrateur --- */
.admin-trigger-container {
    position: fixed;
    bottom: 15px;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 99999 !important;
    pointer-events: auto !important;
}
.admin-trigger-btn {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}
.admin-trigger-btn:hover {
    background: #ff4b72;
    transform: translateY(-2px);
}

/* --- Fenêtre Modale (Admin) --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100000 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal.hidden {
    display: none !important;
}
.modal-content {
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    background: #1a1528;
    border: 2px solid #ff4b72;
}
.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    color: white;
    cursor: pointer;
}