/* Fusion Flow - Intégration omesjeux */

/* Game Main Container */
#game-main {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}

/* Game Container */
#game-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 80px);
    min-height: 500px;
    overflow: hidden;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* Canvas */
#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* UI Overlay */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

#ui-overlay > * {
    pointer-events: auto;
}

/* Header */
#game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#level-display, #score-display, #progress-display, #best-score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 13px;
    color: #e8e8e8;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#level-display span:first-child,
#score-display span:first-child,
#progress-display span:first-child,
#best-score-display span:first-child {
    font-size: 11px;
    opacity: 0.7;
}

#level-number, #current-score {
    font-size: 22px;
    font-weight: bold;
    color: #e94560;
}

#best-score {
    font-size: 18px;
    font-weight: bold;
    color: #ffd93d;
}

#shapes-count {
    font-size: 16px;
    font-weight: bold;
    color: #4ade80;
}

/* Screens */
#game-container .screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #e8e8e8;
}

#game-container .screen.active {
    display: flex;
}

/* Menu Screen */
#menu-screen {
    gap: 20px;
}

#game-title {
    font-size: clamp(28px, 8vw, 52px);
    font-weight: 300;
    letter-spacing: 4px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #e94560, #ff6b6b, #ffd93d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    margin-bottom: 5px;
}

#game-tagline {
    font-size: clamp(13px, 3vw, 16px);
    opacity: 0.8;
    font-weight: 300;
    color: #e8e8e8;
}

#menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

/* Buttons */
#game-container .game-button {
    min-width: 180px;
    min-height: 44px;
    padding: 12px 32px;
    border: none;
    border-radius: 22px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#game-container .game-button.primary {
    background: linear-gradient(135deg, #e94560, #ff6b6b);
    color: white;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

#game-container .game-button.primary:hover,
#game-container .game-button.primary:active {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(233, 69, 96, 0.6);
}

#game-container .game-button.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #e8e8e8;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

#game-container .game-button.secondary:hover,
#game-container .game-button.secondary:active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

#game-container .game-button.small {
    min-width: 70px;
    min-height: 32px;
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.15);
    color: #e8e8e8;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

/* Playing Screen */
#game-container #playing-screen {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    padding: 60px 12px 12px 12px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: none;
}

#game-container #playing-screen .game-button {
    pointer-events: auto;
}

/* Level Complete / Game Over Screens */
#level-complete-screen,
#game-over-screen {
    gap: 16px;
}

#level-complete-screen h2,
#game-over-screen h2 {
    font-size: clamp(22px, 5vw, 32px);
    color: #ffd93d;
}

#level-score, #level-bonus, #final-score {
    font-size: 18px;
    color: #e8e8e8;
}

#level-score-value, #final-score-value {
    font-size: 26px;
    font-weight: bold;
    color: #4ade80;
    margin-left: 8px;
}

#level-bonus-value {
    color: #ffd93d;
    font-weight: bold;
    margin-left: 8px;
}

/* Modal */
#game-container .modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100;
}

#game-container .modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 16px;
    padding: 24px;
    max-width: 90%;
    max-height: 80%;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e8e8e8;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.modal-content h2 {
    color: #e94560;
    margin-bottom: 16px;
    font-size: clamp(18px, 4vw, 24px);
}

#rules-text h3 {
    color: #ffd93d;
    margin: 16px 0 8px 0;
    font-size: 15px;
}

#rules-text p, #rules-text li {
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 8px;
}

#rules-text ul {
    padding-left: 18px;
}

#rules-text li {
    margin-bottom: 6px;
}

/* Shape Icons */
#shapes-preview {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin: 12px 0;
}

.shape-icon {
    display: inline-block;
    width: 36px;
    height: 36px;
}

.shape-icon.circle {
    background: #e94560;
    border-radius: 50%;
}

.shape-icon.square {
    background: #4ade80;
    border-radius: 4px;
}

.shape-icon.triangle {
    width: 0;
    height: 0;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-bottom: 36px solid #ffd93d;
    background: transparent;
}

/* Toast */
#game-container .toast {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 200;
    opacity: 1;
    transition: opacity 0.3s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    white-space: nowrap;
}

#game-container .toast.hidden {
    opacity: 0;
    pointer-events: none;
}

#game-container .toast.success {
    border-left: 4px solid #4ade80;
}

#game-container .toast.error {
    border-left: 4px solid #e94560;
}

/* Responsive */
@media (max-width: 480px) {
    #game-container {
        height: calc(100vh - 60px);
        min-height: 400px;
        border-radius: 12px;
    }

    #game-header {
        padding: 8px 10px;
    }

    #level-display span:first-child,
    #score-display span:first-child,
    #best-score-display span:first-child,
    #progress-display span:first-child {
        font-size: 9px;
    }

    #level-number, #current-score {
        font-size: 18px;
    }

    #best-score {
        font-size: 14px;
    }

    #game-container .game-button {
        min-width: 140px;
        padding: 10px 24px;
        font-size: 14px;
    }

    #game-container .game-button.small {
        min-width: 60px;
        padding: 5px 10px;
        font-size: 11px;
    }

    .modal-content {
        padding: 16px;
    }

    #rules-text h3 {
        font-size: 13px;
    }

    #rules-text p, #rules-text li {
        font-size: 11px;
    }
}

/* High DPI */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #gameCanvas {
        image-rendering: optimizeSpeed;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    #game-container * {
        animation: none !important;
        transition: none !important;
    }
}
