/* --- Premium Game Boy Aesthetic (Puli.dev) --- */

:root {
    --gb-body: #c0c0c0;
    --gb-body-gradient: linear-gradient(145deg, #dcdcdc, #b0b0b0);
    --gb-bezel: #555566;
    --gb-screen-bg: #8b970f;
    --gb-screen-off: #333;
    --btn-a: #A90924;
    --btn-b: #A90924;
    --btn-start-select: #555;
    --dpad-color: #222;
    --shadow-soft: 5px 5px 15px rgba(0, 0, 0, 0.2), -5px -5px 15px rgba(255, 255, 255, 0.8);
    --shadow-inset: inset 2px 2px 5px rgba(0, 0, 0, 0.4), inset -1px -1px 2px rgba(255, 255, 255, 0.2);
    --shadow-drop: 0 10px 30px rgba(0, 0, 0, 0.3);
}

body {
    background-color: #1a1a1a;
    /* Dark presentation background */
    margin: 0;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    touch-action: none;
    /* Prevent browser zooming/scrolling */
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    user-select: none;
    -webkit-user-select: none;
}

/* --- Chassis --- */
.gameboy-chassis {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--gb-body-gradient);
    position: relative;
    overflow: hidden;
    /* Hide anything spilling out */
}

/* Desktop: Full screen game usually, but we want the aesthetic frame if space permits?
   For now, sticking to the hybrid approach: Fullscreen on desktop, GB on mobile.
*/
#game-screen {
    width: 100%;
    height: 100%;
}

@media (min-width: 1025px) {
    .gameboy-chassis {
        background: #000;
    }

    .controls-area,
    .brand-text,
    .speaker-grill,
    .power-led {
        display: none;
    }

    .screen-bezel {
        display: block;
        background: transparent;
        padding: 0;
        border: none;
        box-shadow: none;
        width: 100%;
        height: 100%;
    }

    .screen-area {
        width: 100vw;
        height: 100vh;
        margin: 0;
    }

    .screen-glass {
        width: 100%;
        height: 100%;
        border-radius: 0;
        box-shadow: none;
        border: none;
    }

    canvas {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain;
    }
}

/* --- Mobile / Tablet Mode --- */
@media (max-width: 1024px),
(hover: none) {

    .gameboy-chassis {
        height: 100vh;
        width: 100vw;
        justify-content: flex-start;
        padding-top: 2vh;
        border-radius: 0;
        box-shadow: none;
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* --- Screen Section --- */
    .screen-area {
        width: 90%;
        max-width: 400px;
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        /* Force 1:1 Aspect Ratio logic roughly here or on the glass */
    }

    .screen-bezel {
        width: 100%;
        background-color: var(--gb-bezel);
        border-radius: 12px 12px 40px 12px;
        padding: 20px 25px 35px 25px;
        /* Extra bottom padding for "Nintendo" */
        box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.5), 0 5px 15px rgba(0, 0, 0, 0.3);
        box-sizing: border-box;
        position: relative;
    }

    .screen-glass {
        width: 100%;
        aspect-ratio: 1/1;
        background-color: #8da90e;
        /* Classic greenish */
        box-shadow: inset 4px 4px 10px rgba(0, 0, 0, 0.5);
        border-radius: 4px;
        position: relative;
        overflow: hidden;
        border: 4px solid #4a4a58;
        /* Darker bezel ring */
        margin-bottom: 5px;
    }

    /* CRT/Pixel Effect Overlay (Optional, for aesthetics) */
    .screen-glass::after {
        content: "";
        pointer-events: none;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
        background-size: 100% 2px, 3px 100%;
        opacity: 0.3;
        z-index: 10;
    }

    #game-screen canvas {
        width: 100% !important;
        height: 100% !important;
        object-fit: fill;
        /* Fill the square */
        filter: contrast(1.1) saturate(1.1);
    }

    .power-led {
        position: absolute;
        top: 30%;
        left: 8px;
        /* On the bezel */
        width: 8px;
        height: 8px;
        background-color: #900;
        border-radius: 50%;
        box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5);
    }

    .power-led.on {
        background-color: #f00;
        box-shadow: 0 0 6px #f00;
    }

    .brand-text {
        position: absolute;
        bottom: 10px;
        left: 25px;
        font-family: 'Arial', sans-serif;
        font-weight: 700;
        font-size: 10px;
        color: #9da0bd;
        letter-spacing: 0.5px;
        display: flex;
        gap: 15px;
        align-items: baseline;
    }

    .brand-gameboy {
        font-family: serif;
        font-style: italic;
        font-size: 14px;
        letter-spacing: 1px;
    }

    /* --- Controls Section --- */
    .controls-area {
        flex: 1;
        width: 100%;
        max-width: 400px;
        position: relative;
        margin-top: 10px;
        /* Glassmorphism backing for modern feel? No, stick to plastic aesthetic */
    }

    /* JOYSTICK / DPAD Styles */
    .dpad-group {
        position: absolute;
        top: 20px;
        left: 25px;
        width: 120px;
        height: 120px;
    }

    .dpad-physical {
        position: absolute;
        top: 15px;
        left: 15px;
        width: 90px;
        height: 90px;
    }

    /* Re-creating a premium D-Pad */
    .dpad-axis {
        background: #111;
        position: absolute;
        border-radius: 4px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4), inset 2px 2px 5px rgba(255, 255, 255, 0.1);
        z-index: 1;
    }

    .dpad-y {
        width: 32px;
        height: 90px;
        left: 29px;
        top: 0;
    }

    .dpad-x {
        width: 90px;
        height: 32px;
        top: 29px;
        left: 0;
    }

    /* Central pivot circle */
    .dpad-physical::after {
        content: '';
        position: absolute;
        width: 20px;
        height: 20px;
        background: radial-gradient(circle at 30% 30%, #333, #000);
        top: 35px;
        left: 35px;
        border-radius: 50%;
        z-index: 2;
        box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.1);
    }

    /* Touch Targets (Invisible normally, visible press state via JS) */
    .btn {
        /* Shared base for touch targets */
        position: absolute;
        z-index: 100;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .dpad-group .btn {
        width: 45px;
        height: 45px;
    }

    .dpad-group .btn-up {
        top: 0;
        left: 37px;
    }

    .dpad-group .btn-down {
        bottom: 0;
        left: 37px;
    }

    .dpad-group .btn-left {
        top: 37px;
        left: 0;
    }

    .dpad-group .btn-right {
        top: 37px;
        right: 0;
    }

    /* Visual Feedback for D-Pad press */
    .dpad-group .btn.active {
        /* We can't easily animate the physical CSS dpad axes individually 
           without complex JS. So we show a subtle highlight glow. */
        background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    }

    /* --- Action Buttons (A/B) --- */
    .action-group {
        position: absolute;
        top: 30px;
        right: 15px;
        width: 150px;
        height: 100px;
        transform: rotate(-15deg);
    }

    .btn-wrapper {
        position: absolute;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .btn-wrapper.b-btn-wrap {
        bottom: 10px;
        left: 10px;
    }

    .btn-wrapper.a-btn-wrap {
        top: 10px;
        right: 10px;
    }

    .action-group .btn-real {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background: radial-gradient(circle at 30% 30%, #e02040, #900010);
        /* Deep premium red */
        box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.4), inset 2px 2px 5px rgba(255, 255, 255, 0.2);
        border: none;
        transition: transform 0.05s, box-shadow 0.05s;
    }

    .btn-label {
        font-weight: 900;
        color: #333;
        font-size: 14px;
        margin-top: 8px;
        font-family: sans-serif;
    }

    /* Active State (Haptic Visualization) */
    .action-group .btn-real:active,
    .action-group .btn-real.pressed {
        transform: scale(0.95) translate(1px, 1px);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), inset 2px 2px 10px rgba(0, 0, 0, 0.5);
        background: radial-gradient(circle at 30% 30%, #c01030, #70000a);
    }

    /* Select / Start */
    .option-group {
        position: absolute;
        bottom: 70px;
        /* Shifted up slightly */
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        gap: 15px;
    }

    .select-start-wrapper {
        transform: rotate(-15deg);
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .pill-btn {
        width: 50px;
        height: 14px;
        background: linear-gradient(180deg, #555, #333);
        border-radius: 10px;
        box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
        border: 1px solid #222;
        margin-bottom: 4px;
    }

    .select-start-wrapper .btn-label {
        margin-top: 0;
        font-size: 11px;
        color: #333;
        letter-spacing: 0.5px;
    }

    /* Speaker */
    .speaker-grill {
        position: absolute;
        bottom: 30px;
        right: 30px;
        transform: rotate(-15deg);
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .slot {
        width: 60px;
        height: 6px;
        background-color: rgba(0, 0, 0, 0.15);
        border-radius: 4px;
        box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.2);
    }
}

/* --- Resume Overlay (Aesthetic Update) --- */
.resume-overlay {
    background: rgba(10, 10, 15, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    border-radius: 16px;
    font-family: 'Inter', sans-serif;
    /* Clean font for resume */
}

.resume-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.resume-header h1 {
    font-family: 'Press Start 2P', cursive;
    /* Keep headers retro */
    color: #FF4D4D;
    text-shadow: 0 0 10px rgba(255, 77, 77, 0.5);
}

.toggle-resume-btn {
    background: linear-gradient(135deg, #e70012, #b3000e);
    box-shadow: 0 4px 10px rgba(231, 0, 18, 0.4);
    border: none;
    border-radius: 8px;
    z-index: 200;
}

.toggle-resume-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(231, 0, 18, 0.6);
}

/* --- Branding --- */
.made-by-puli {
    position: absolute;
    bottom: 15px;
    width: 100%;
    text-align: center;
    font-size: 10px;
    color: rgba(0, 0, 0, 0.3);
    font-family: sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    pointer-events: auto;
    /* Allow clicking the link */
    z-index: 50;
}

.made-by-puli a {
    color: inherit;
    text-decoration: none;
    font-weight: bold;
}

@media (min-width: 1025px) {
    .made-by-puli {
        display: none;
        /* Hide on desktop for clean look, or keep it depending on preference. User asked for 'mobile ui' fixes specifically */
        color: #555;
    }
}