/* ═══════════════════════════════════════════════════
   PLATFORMER UI STYLES
   ═══════════════════════════════════════════════════ */

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

/* ─── Canvas ─── */
#game-canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    image-rendering: pixelated;
    object-fit: contain;
    /* Ensure full game is visible */
    background: #5c94fc;
}

/* ─── HUD Layer ─── */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

/* Orientation Warning */
#orientation-warning {
    display: none;
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 10000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

@media (orientation: portrait) and (max-width: 900px) {
    #orientation-warning {
        display: flex;
    }
}

.game-progress-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    max-width: 600px;
    height: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    overflow: visible;
    display: flex;
    align-items: center;
    backdrop-filter: blur(4px);
    z-index: 1000;
}

.game-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ffce00, #ff8000);
    border-radius: 20px;
    box-shadow: 0 0 15px rgba(255, 206, 0, 0.5);
    transition: width 0.1s ease-out;
}

.progress-label {
    position: absolute;
    top: -15px;
    font-size: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Press Start 2P', cursive;
}

.label-start {
    left: 0;
}

.label-end {
    right: 0;
}

@media (max-width: 600px) {
    .game-progress-container {
        width: 80%;
        top: 15px;
        height: 8px;
    }
}

/* ─── Mobile Controls (Redesign) ─── */
.mobile-controls {
    position: absolute;
    bottom: clamp(10px, 5vh, 40px);
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 5%;
    box-sizing: border-box;
    pointer-events: none;
}

.d-pad-group,
.action-group {
    display: flex;
    gap: 15px;
    pointer-events: auto;
}

.joy-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    touch-action: manipulation;
    transition: transform 0.1s, background 0.1s;
    user-select: none;
}

.joy-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.3);
}

.btn-jump {
    background: rgba(0, 200, 80, 0.3);
    border-color: rgba(0, 255, 100, 0.5);
}

.btn-down {
    background: rgba(255, 200, 0, 0.3);
    border-color: rgba(255, 220, 0, 0.5);
}

@media (min-width: 1025px) {
    .mobile-controls {
        display: none;
    }
}

@media (max-width: 1024px) {
    .controls-hint {
        display: none;
    }

    .mario-hud {
        padding: 5px 15px;
    }
}

/* ─── Overlays / Modals ─── */
#game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Better for scrolling */
    padding: 40px 0;
    /* Add space for scrolling */
    overflow-y: auto;
    pointer-events: auto;
    transition: background 0.3s;
    -webkit-overflow-scrolling: touch;
}

#game-overlay.story-mode {
    background: rgba(0, 0, 0, 0.1);
}

#game-overlay.hidden {
    display: none;
}

.overlay-box {
    background: #000;
    border: 4px solid #fff;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    color: #fff;
    box-shadow: 0 0 0 4px #000, 0 10px 30px rgba(0, 0, 0, 0.5);
    font-family: 'Inter', sans-serif;
    margin-bottom: 20px;
}

#game-overlay.story-mode .overlay-box {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    width: 95%;
}

.pixel-title {
    font-family: 'Press Start 2P', cursive;
    color: #ffce00;
    margin-bottom: 15px;
    line-height: 1.4;
    font-size: clamp(14px, 4vw, 20px);
}

#overlay-close {
    background: #ff4040;
    color: white;
    border: none;
    padding: 15px 30px;
    font-family: 'Press Start 2P', cursive;
    cursor: pointer;
    border: 4px solid #aa0000;
    box-shadow: 0 4px 0 #550000;
}

#overlay-close:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* Specific Content Styles */
.pixel-card h3 {
    color: #5c94fc;
    margin-bottom: 10px;
}

.project-tags span {
    display: inline-block;
    background: #333;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    margin: 5px;
}

.pixel-link {
    display: inline-block;
    margin-top: 15px;
    color: #ffce00;
    text-decoration: none;
    border-bottom: 2px solid #ffce00;
}

/* ─── Project Modal V2 ─── */
.project-modal-v2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.project-challenge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 16px;
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #eee;
    text-align: left;
    width: 100%;
    backdrop-filter: blur(4px);
}

.project-challenge strong {
    display: block;
    color: #ffce00;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    margin-bottom: 10px;
}

.project-preview-img {
    width: 100%;
    aspect-ratio: 16/9;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    border: 4px solid #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.challenge-btn {
    width: 100%;
    text-decoration: none;
    text-align: center;
    padding: 20px !important;
}

@media (max-width: 600px) {
    .project-challenge {
        font-size: 14px;
        padding: 15px;
    }

    .project-challenge strong {
        font-size: 8px;
    }
}