@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;700&family=Nunito:wght@700&display=swap');

#wam-wrapper {
    /* Couleurs Ergo'Land */
    --wam-bg: #f0f4f8;
    --wam-primary: #667eea;
    --wam-secondary: #764ba2;
    --wam-hole-bg: #2d3436;
    --wam-text: #2d3748;
    
    font-family: 'Nunito', sans-serif;
    width: 100%; min-height: 600px;
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    display: flex; justify-content: center; align-items: center;
    padding: 20px;
    user-select: none;
}

#wam-wrapper:fullscreen { 
    width: 100vw; height: 100vh; padding: 0; 
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    display: flex; align-items: center; justify-content: center;
}
#wam-wrapper * { box-sizing: border-box; touch-action: manipulation; }

/* CONTENEUR PRINCIPAL */
#wam-container {
    width: 100%; max-width: 600px;
    background: white;
    border-radius: 25px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    overflow: hidden;
    position: relative;
    display: flex; flex-direction: column;
    height: 80vh; min-height: 600px;
    border: 6px solid #fff;
}

#wam-wrapper:fullscreen #wam-container { 
    height: 95vh; max-width: 800px; border-radius: 20px; border: 8px solid #fff;
}

/* HEADER */
.wam-header {
    background: #f8f9fa; padding: 15px 25px;
    display: flex; flex-direction: column; gap: 15px;
    border-bottom: 2px solid #edf2f7;
}

.wam-title {
    margin: 0; font-family: 'Fredoka', sans-serif;
    background: linear-gradient(to right, var(--wam-primary), var(--wam-secondary));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    font-size: 1.8rem; text-align: center; letter-spacing: 1px;
}

.wam-hud { display: flex; justify-content: space-between; align-items: center; }

.wam-stat-box {
    display: flex; flex-direction: column; align-items: center;
    background: white; padding: 5px 20px; border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); border: 1px solid #e2e8f0;
}
.wam-stat-box .label { font-size: 0.7rem; color: #a0aec0; font-weight: 800; letter-spacing: 1px; }
.wam-stat-box .value { font-size: 1.5rem; font-weight: 800; color: var(--wam-secondary); line-height: 1.2; }

.wam-controls { position: absolute; top: 15px; right: 15px; display: flex; gap: 8px; }
.wam-icon-btn {
    width: 36px; height: 36px; border-radius: 50%; border: none;
    background: #edf2f7; color: var(--wam-text); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s; font-size: 1rem;
}
.wam-icon-btn:hover { background: var(--wam-primary); color: white; }

/* PLATEAU DE JEU */
#wam-game-board {
    flex-grow: 1;
    background: #81ecec;
    background-image: radial-gradient(#55efc4 20%, transparent 20%), radial-gradient(#55efc4 20%, transparent 20%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    background-color: #dff9fb;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 15px;
    align-items: center; justify-items: center;
}

/* LES TROUS */
.wam-hole {
    position: relative;
    width: 100%; height: 100%;
    max-width: 120px; max-height: 120px;
    background: var(--wam-hole-bg);
    border-radius: 50%;
    box-shadow: inset 0 10px 20px rgba(0,0,0,0.5), 0 5px 0 rgba(255,255,255,0.5);
    overflow: hidden;
}

/* Base de terre */
.wam-hole::after {
    content: ''; display: block;
    position: absolute; bottom: -10px; left: 0; width: 100%; height: 30px;
    background: url('data:image/svg+xml;utf8,<svg width="100" height="30" xmlns="http://www.w3.org/2000/svg"><path d="M0,10 Q50,40 100,10 L100,30 L0,30 Z" fill="%238d6e63"/></svg>');
    background-size: cover; z-index: 5;
}

/* LES SOURIS (Personnages) */
.wam-mole {
    position: absolute;
    top: 100%; /* Caché en bas */
    left: 50%; transform: translateX(-50%);
    width: 70%; height: 80%;
    display: flex; justify-content: center; align-items: center;
    font-size: 3rem;
    transition: top 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    z-index: 2;
    pointer-events: none;
}

.wam-hole.up .wam-mole {
    top: 10%; /* Visible */
    pointer-events: auto;
}

/* SKINS MIS A JOUR */
.wam-mole::before { content: '🐭'; filter: drop-shadow(0 5px 5px rgba(0,0,0,0.3)); }
.wam-mole.bunny::before { content: '🐰'; }
.wam-mole.king::before { content: '👑'; font-size: 3.5rem; filter: drop-shadow(0 0 10px gold); }

/* Animation de frappe */
.wam-hole.bonked .wam-mole {
    top: 100%;
    transition: top 0.1s ease-in;
}
.wam-hole.bonked::before {
    content: '💥'; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    font-size: 2.5rem; z-index: 10; animation: fadeUp 0.5s forwards;
}

/* Score flottant */
.float-score {
    position: absolute; color: #fff; font-weight: bold; font-size: 1.2rem;
    pointer-events: none; z-index: 20; text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    animation: floatUp 0.8s forwards;
}
.float-score.plus { color: #00b894; }
.float-score.minus { color: #ff7675; }

@keyframes floatUp { to { transform: translateY(-50px); opacity: 0; } }
@keyframes fadeUp { 0% { opacity: 1; transform: translateX(-50%) scale(0.5); } 100% { opacity: 0; transform: translateX(-50%) scale(1.5); } }

/* MENUS */
.wam-overlay {
    position: absolute; inset: 0; background: rgba(255,255,255,0.9);
    backdrop-filter: blur(5px); z-index: 50;
    display: flex; justify-content: center; align-items: center;
}
.wam-overlay.hidden { display: none; }

.wam-card {
    background: white; padding: 40px; border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); text-align: center;
    width: 90%; max-width: 400px; border: 1px solid #edf2f7;
}
.wam-card h2 { color: var(--wam-secondary); font-family: 'Fredoka'; margin-bottom: 20px; }

/* BOUTONS DIFFICULTE */
.wam-difficulty-select { display: flex; gap: 10px; margin: 20px 0; flex-direction: column; }
.wam-diff-btn {
    padding: 12px; border: 2px solid #edf2f7; background: white;
    border-radius: 50px; font-weight: bold; cursor: pointer; color: #718096;
    transition: 0.2s; font-family: 'Nunito';
}
.wam-diff-btn:hover { border-color: var(--wam-primary); color: var(--wam-primary); }
.wam-diff-btn.selected {
    background: var(--wam-primary); color: white; border-color: var(--wam-primary);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.4);
}

/* BOUTONS ACTION */
.wam-btn-primary {
    background: linear-gradient(90deg, var(--wam-primary), var(--wam-secondary));
    color: white; border: none; padding: 12px 30px; border-radius: 50px;
    font-weight: 800; font-size: 1.1rem; cursor: pointer;
    box-shadow: 0 5px 15px rgba(118, 75, 162, 0.3); transition: transform 0.2s;
}
.wam-btn-primary:hover { transform: translateY(-2px); }
.wam-btn-secondary {
    background: transparent; border: 2px solid #cbd5e0; color: #718096;
    padding: 10px 25px; border-radius: 50px; font-weight: bold; cursor: pointer;
    margin-left: 10px;
}

.wam-result-box {
    background: #f7fafc; padding: 20px; border-radius: 15px; margin-bottom: 20px;
}
.wam-final-score { font-size: 3rem; font-weight: 800; color: var(--wam-primary); font-family: 'Fredoka'; }
.wam-stats p { margin: 5px 0; color: #4a5568; font-size: 0.9rem; font-weight: 600; }

@media (max-width: 600px) {
    #wam-game-board { gap: 10px; padding: 10px; }
    .wam-title { font-size: 1.4rem; }
    .wam-stat-box { padding: 5px 10px; }
    .wam-stat-box .value { font-size: 1.2rem; }
}