@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;800&family=Poppins:wght@400;600&display=swap');

#laby-wrapper {
    background: linear-gradient(135deg, #1e1e2f 0%, #0f0f1a 100%);
    width: 100%; min-height: 600px;
    padding: 10px; display: flex; justify-content: center; align-items: center;
    font-family: 'Poppins', sans-serif;
}
#laby-wrapper:fullscreen { width: 100vw; height: 100vh; padding: 0; border-radius: 0; }
#laby-wrapper * { box-sizing: border-box; touch-action: none; }

#laby-container {
    background: #150f22; 
    border-radius: 20px; width: 100%; max-width: 900px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.4); display: flex; flex-direction: column;
    overflow: hidden; border: 4px solid #fff;
}
#laby-wrapper:fullscreen #laby-container { max-width: 1000px; height: 95vh; border-radius: 25px; }

.laby-header {
    background: #1f1633; padding: 15px 25px; display: flex; justify-content: space-between;
    align-items: center; border-bottom: 2px solid #667eea;
}
.laby-title {
    margin: 0; color: #8ec5fc; font-family: 'Orbitron', sans-serif; font-size: 1.5rem;
    text-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}
.laby-stats { display: flex; gap: 15px; }
.stat-box { background: rgba(255,255,255,0.1); padding: 5px 15px; border-radius: 20px; color: #fff; font-weight: 600; font-family: 'Orbitron', sans-serif; }
.stat-box span { font-size: 1.1rem; }

.laby-btn-icon {
    background: transparent; border: 2px solid #667eea; color: #667eea;
    width: 36px; height: 36px; border-radius: 50%; cursor: pointer; transition: 0.2s;
    display: flex; justify-content: center; align-items: center; font-size: 1.2rem;
    flex-shrink: 0;
}
.laby-btn-icon:hover { background: rgba(102, 126, 234, 0.2); box-shadow: 0 0 10px #667eea; }

#canvas-wrapper { position: relative; flex-grow: 1; width: 100%; min-height: 500px; background: #0b0714; cursor: crosshair; }
#laby-canvas { display: block; width: 100%; height: 100%; }

/* MENUS OVERLAYS */
.laby-overlay {
    position: absolute; inset: 0; background: rgba(11, 7, 20, 0.85); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center; z-index: 50; transition: opacity 0.3s;
}
.laby-overlay.hidden { display: none !important; opacity: 0; }
.laby-overlay.active { display: flex !important; opacity: 1; animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.laby-card {
    background: white; padding: 40px; border-radius: 20px; text-align: center;
    width: 90%; max-width: 450px; box-shadow: 0 15px 30px rgba(0,0,0,0.5); border: 4px solid #667eea;
}
.laby-card h2 { color: #1e1e2f; margin-top: 0; margin-bottom: 10px; font-family: 'Orbitron', sans-serif; }

.laby-btn {
    border: none; padding: 12px 20px; border-radius: 50px; font-size: 1.1rem;
    font-weight: bold; cursor: pointer; width: 100%; transition: 0.2s; font-family: 'Poppins', sans-serif;
}
.laby-btn.primary { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4); }
.laby-btn.primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6); }
.laby-btn.secondary { background: #f1f5f9; color: #475569; border: 2px solid #cbd5e1; }
.laby-btn.danger { background: #fff5f5; color: #e74c3c; border: 2px solid #fecaca; }

.laby-final-score {
    width: 120px; height: 120px; border-radius: 50%; background: linear-gradient(135deg, #667eea, #764ba2); color: #fff;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    font-size: 2.5rem; font-weight: 800; font-family: 'Orbitron', sans-serif;
    margin: 20px auto; box-shadow: 0 0 30px rgba(102, 126, 234, 0.5); border: 5px solid white;
}
.laby-final-score small { font-size: 1rem; font-weight: 600; }

/* GRILLE DES NIVEAUX */
.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    max-height: 350px;
    overflow-y: auto;
    padding: 10px;
}
.lvl-btn {
    background: #1a1a2e; border: 2px solid #3a3a5a; color: #475569;
    border-radius: 12px; padding: 10px 5px; font-weight: bold; cursor: pointer;
    transition: 0.2s; font-family: 'Orbitron', sans-serif;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.lvl-btn.unlocked { border-color: #00d2ff; color: #00d2ff; background: rgba(0, 210, 255, 0.1); }
.lvl-btn.unlocked:hover { background: #00d2ff; color: #000; box-shadow: 0 0 10px #00d2ff; transform: translateY(-2px); }
.lvl-btn.locked { opacity: 0.3; cursor: not-allowed; }
.levels-grid::-webkit-scrollbar { width: 6px; }
.levels-grid::-webkit-scrollbar-track { background: #1a1a2e; border-radius: 10px; }
.levels-grid::-webkit-scrollbar-thumb { background: #00d2ff; border-radius: 10px; }

@media (max-width: 600px) {
    .laby-header { flex-direction: column; gap: 10px; }
    .laby-card { padding: 20px; }
    .editor-controls { flex-direction: column; }
}