@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #333;
    overflow: hidden;
    touch-action: none; /* Prevent scroll on mobile */
    font-family: 'Press Start 2P', cursive;
    user-select: none;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Canvas truly responsive */
#gameCanvas {
    background-color: #4ec0ca;
    width: 100%;
    height: 100%;
    display: block;
}

/* UI Layer */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to canvas */
}

/* Draggable elements */
.draggable {
    position: absolute;
    pointer-events: auto;
    color: white;
    text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
    font-size: 10px;
    white-space: nowrap;
    transition: opacity 0.2s;
    z-index: 10;
}

.draggable:hover {
    opacity: 0.5; /* "s'estompe quand on passe la souris" */
}

.draggable.hidden-element {
    opacity: 0.2 !important;
}

.eye-icon {
    display: none;
    position: absolute;
    top: -15px;
    right: -15px;
    cursor: pointer;
    font-size: 16px;
    text-shadow: none;
}

/* Pause Button */
#pause-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    pointer-events: auto;
    font-size: 24px;
    cursor: pointer;
    text-shadow: 2px 2px 0 #000;
    z-index: 10;
}
#pause-btn:active {
    transform: scale(0.9);
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    pointer-events: auto;
}

.hidden {
    display: none !important;
}

/* Panels */
.panel {
    background-color: #ded895; /* Cream */
    border: 4px solid #543847; /* Brown */
    border-radius: 5px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    max-width: 90%;
}

.pixel-text {
    margin: 10px 0;
    text-shadow: 2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white;
}
.orange-text {
    color: #e86101;
}
.small-text {
    font-size: 10px;
    color: #543847;
    text-shadow: none;
    margin-bottom: 20px;
}

/* Buttons */
.btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.flappy-btn {
    background-color: #e86101;
    color: white;
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    border: 3px solid white;
    outline: 3px solid #543847;
    padding: 10px;
    cursor: pointer;
    text-shadow: 1px 1px 0 #000;
}
.flappy-btn:active {
    transform: translateY(2px);
}
.small-btn {
    font-size: 10px;
    padding: 8px;
}

/* Settings */
.settings-panel {
    width: 300px;
}
.setting-row, .event-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 8px;
    color: #543847;
    text-align: left;
}
.num-input, .key-input {
    width: 40px;
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    text-align: center;
    border: 2px solid #543847;
    background: #fff;
}
.key-input {
    width: 20px;
}

/* Custom overlay mode */
#custom-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 5; /* Under UI layer, over canvas */
    background: rgba(0, 0, 0, 0.2);
    pointer-events: auto;
}
#btn-finish-custom {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
}
.customizing .draggable {
    outline: 2px dashed yellow;
    cursor: grab;
}
.customizing .eye-icon {
    display: block;
}

/* Flash */
#screen-flash {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: white;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
}
.flash-anim {
    animation: flash 0.5s ease-out;
}
@keyframes flash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}
