/* Layout Global (Premium UI) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    background-color: #0b0b12;
    color: #e0e0e0;
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: row;
}

/* Panneau de Gauche (Glassmorphism & Neon) */
#left-panel {
    width: 25%;
    min-width: 250px;
    max-width: 350px;
    height: 100%;
    background: linear-gradient(180deg, rgba(26, 26, 40, 0.95) 0%, rgba(15, 15, 22, 0.95) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    padding: 8px;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10;
}

#left-panel::-webkit-scrollbar {
    width: 5px;
}

#left-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

#right-panel {
    flex-grow: 1;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1a1a2e 0%, #05050a 100%);
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

#canvas-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: auto;
}

#banner-container {
    position: absolute;
    bottom: 0;
    width: 100%;
    min-height: 50px;
    display: flex;
    justify-content: center;
    z-index: 20;
}

#canvas-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: auto;
    /* Premium centering without clipping */
    position: relative;
    width: 100%;
    height: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    background: #1a1a24;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    /* Smooth zoom */
    transform-origin: top left;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    margin: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#bg-canvas {
    z-index: 1;
}

#render-canvas {
    z-index: 2;
}

#canvas-container.tool-pipette #render-canvas {
    cursor: crosshair;
}

#canvas-container.tool-brush #render-canvas {
    cursor: crosshair;
}

#canvas-container.tool-eraser #render-canvas {
    cursor: pointer;
}

#canvas-container.tool-move #render-canvas {
    cursor: move;
}

/* Entête */
header {
    text-align: center;
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

header h1 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    background: linear-gradient(90deg, #ff9900, #ff007f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#level-display {
    margin: 2px 0 0 0;
    color: #00d2ff;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Sections du Panneau */
.panel-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 4px 8px;
    margin-bottom: 4px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.panel-section.color-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Carousel des poses */
.pose-carousel {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 4px 0;
    margin-top: 4px;
    margin-bottom: 6px;
}

.pose-carousel::-webkit-scrollbar {
    height: 4px;
}

.pose-carousel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.pose-thumbnail {
    width: 36px;
    height: 36px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.pose-thumbnail:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.pose-thumbnail.active {
    border-color: #00d2ff;
    background: rgba(0, 210, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.slider-row label {
    font-size: 0.7rem;
    color: #aaa;
    font-weight: 600;
    width: 65px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type=range] {
    -webkit-appearance: none;
    flex-grow: 1;
    background: transparent;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #00d2ff;
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.6);
    transition: transform 0.1s;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Outils */
.tool-group {
    display: flex;
    gap: 6px;
    justify-content: space-between;
}

.tool-btn {
    flex-grow: 1;
    padding: 6px 2px;
    background: rgba(255, 255, 255, 0.05);
    color: #ccc;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
    transition: all 0.2s ease;
    text-align: center;
    line-height: 1.2;
}

.tool-icon {
    display: block;
    font-size: 1.2rem;
    margin-top: 4px;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.tool-btn.active {
    background: rgba(0, 210, 255, 0.15);
    color: #00d2ff;
    border-color: #00d2ff;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.2);
}

#zoom-level-text {
    font-weight: bold;
    color: #00d2ff;
    min-width: 45px;
    text-align: center;
}

/* Color Picker Container */
#color-picker-container {
    margin-bottom: 4px;
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Swatches Grid */
.swatches-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    padding: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}

.swatch-btn {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.swatch-btn:hover {
    border-color: #fff;
    transform: scale(1.3);
    z-index: 2;
}

/* Actions fixées en bas */
.actions-section {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.action-btn {
    width: 100%;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: transform 0.2s, filter 0.2s, box-shadow 0.2s;
}

.reset-btn {
    background: rgba(255, 51, 51, 0.1);
    color: #ff3333;
    padding: 8px;
    font-size: 0.75rem;
    border: 1px solid rgba(255, 51, 51, 0.3);
}

.reset-btn:hover {
    background: rgba(255, 51, 51, 0.2);
    border-color: #ff3333;
}

.validate-btn {
    background: linear-gradient(135deg, #ff9900, #ff007f);
    color: #fff;
    padding: 12px;
    font-size: 0.95rem;
    box-shadow: 0 5px 15px rgba(255, 0, 127, 0.3);
}

.validate-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 8px 20px rgba(255, 0, 127, 0.5);
}

/* Overlay Résultat (Évaluation et Niveaux) */
@keyframes blink {
    0% {
        opacity: 1;
        filter: brightness(1);
    }

    50% {
        opacity: 0.3;
        filter: brightness(1.3);
    }

    100% {
        opacity: 1;
        filter: brightness(1);
    }
}

.blinking {
    animation: blink 0.6s infinite ease-in-out;
}

#result-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    width: min(80%, 400px);
    max-height: 85%;
    overflow-y: auto;
    background: rgba(10, 10, 15, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    padding: 20px;
    box-sizing: border-box;
}

#result-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

#result-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    margin-bottom: 10px;
    color: #fff;
    font-weight: 800;
    letter-spacing: 1px;
}

#result-message {
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    margin-bottom: 20px;
    font-weight: 800;
    text-transform: uppercase;
    text-align: center;
}

.progress-container {
    width: 60%;
    height: 30px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    overflow: hidden;
    margin: 10px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8);
}

#progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ff007f, #ff9900, #00d2ff);
    transition: width 2s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
}

#score-text {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 800;
    margin: 10px 0;
    color: #fff;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.result-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.result-actions .action-btn {
    padding: 12px 25px;
    font-size: 1rem;
    border-radius: 30px;
}

#next-level-btn {
    background: linear-gradient(135deg, #00ff88, #00b3ff);
    color: #000;
    box-shadow: 0 5px 15px rgba(0, 255, 136, 0.3);
    border: none;
}

#next-level-btn:hover {
    filter: brightness(1.2);
    box-shadow: 0 8px 20px rgba(0, 255, 136, 0.5);
}

.hidden {
    display: none !important;
}

/* Menu Overlay */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(8px);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.menu-content {
    background: #1a1a24;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 12px;
    width: 600px;
    max-width: 90%;
    text-align: center;
    max-height: 80vh;
    overflow-y: auto;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.level-card {
    position: relative;
    height: 100px;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: not-allowed;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, border-color 0.2s;
    padding: 0;
}

.level-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1;
    transition: background 0.2s;
}

.level-card.unlocked {
    cursor: pointer;
    border-color: rgba(255, 255, 255, 0.2);
}

.level-card.unlocked::before {
    background: rgba(0, 0, 0, 0.3);
}

.level-card.unlocked:hover {
    transform: scale(1.05);
    border-color: #00d2ff;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.3);
}

.level-card.unlocked:hover::before {
    background: rgba(0, 0, 0, 0.1);
}

.level-card.locked {
    filter: grayscale(100%);
}

.level-card.locked::before {
    background: rgba(0, 0, 0, 0.8);
}

.level-title,
.level-score {
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
}

.level-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: #fff;
    padding: 5px;
    background: rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
}

.level-score {
    font-size: 1.2rem;
    padding: 5px;
}

/* Hunter's Test Animations */
#night-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9;
    opacity: 0;
    transition: opacity 0.5s;
    background: rgba(0, 0, 0, 0.95);
}

#siren-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 8;
    opacity: 0;
    transition: opacity 0.3s;
}

@keyframes sirenFlash {
    0% {
        background-color: rgba(255, 0, 0, 0.3);
    }

    50% {
        background-color: rgba(0, 0, 255, 0.3);
    }

    100% {
        background-color: rgba(255, 0, 0, 0.3);
    }
}

.siren-active {
    opacity: 1 !important;
    animation: sirenFlash 0.8s infinite;
}

#prison-bars {
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9;
    background:
        linear-gradient(to bottom, #222 0px, #222 20px, transparent 20px),
        linear-gradient(to top, #222 0px, #222 20px, transparent 20px),
        repeating-linear-gradient(to right, transparent 0, transparent 60px, #111 60px, #111 80px);
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8);
    transition: top 0.4s cubic-bezier(0.5, 0, 0.3, 1.2);
}

.prison-active {
    top: 0 !important;
}

#escape-scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
    overflow: hidden;
}

.particle {
    position: absolute;
    pointer-events: none;
}

.smoke-particle {
    font-size: 8rem;
    animation: smokeFade 0.8s forwards cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes smokeFade {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }

    100% {
        transform: scale(3) translateY(-40px);
        opacity: 0;
        filter: blur(4px);
    }
}

.money-particle {
    font-size: 5rem;
    animation: moneyFly 1s forwards cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes moneyFly {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translate(var(--dx), var(--dy)) rotate(var(--rot));
        opacity: 0;
    }
}

/* Responsive UI: End of file */