/* =====================================================
   game-layout.css
   Layout responsif portrait — Tema: Hijau Cerah + Pixel Font
   
   CARA PAKAI di file PHP baru:
     <link rel="stylesheet" href="assets/css/game-layout.css">

   Gunakan struktur HTML ini:
     <div id="desktop-wrapper">
       <div id="mobile-frame">
         <div id="status-bar">...</div>
         <div id="game-container"></div>
       </div>
     </div>
===================================================== */

/* ----- Google Fonts: pixel game fonts ----- */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Pixelify+Sans:wght@400;500;600;700&display=swap');



/* ----- Reset & No Scroll ----- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
    background: #0a0f1a;
    font-family: 'Press Start 2P', monospace;
    user-select: none;
    -webkit-user-select: none;
}

/* ----- Desktop wrapper: pusatkan frame mobile ----- */
#desktop-wrapper {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(34, 197, 94, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(59, 130, 246, 0.06) 0%, transparent 60%),
        #0a0f1a;
}

/* ----- Frame Mobile ----- */
#mobile-frame {
    position: relative;

    /* Mobile: full-screen */
    width: 100vw;
    height: 100vh;

    background: #060d18;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Desktop: tampil seperti ponsel portrait */
@media (min-width: 600px) {
    #mobile-frame {
        width: 360px;
        height: 760px;
        border-radius: 36px;
        box-shadow:
            0 0 0 1px rgba(34, 197, 94, 0.3),
            0 0 0 3px rgba(15, 23, 42, 0.8),
            0 0 0 4px rgba(34, 197, 94, 0.15),
            0 32px 80px rgba(0, 0, 0, 0.7),
            0 0 60px rgba(34, 197, 94, 0.12),
            0 0 120px rgba(59, 130, 246, 0.06);
    }

    /* Pixel-art corner highlight on frame */
    #mobile-frame::after {
        content: '';
        position: absolute;
        top: 0; left: 0;
        width: 100%; height: 100%;
        border-radius: 36px;
        background: linear-gradient(145deg,
            rgba(255,255,255,0.04) 0%,
            transparent 40%,
            transparent 60%,
            rgba(0,0,0,0.15) 100%);
        pointer-events: none;
        z-index: 9998;
    }

    /* Notch / pill atas */
    #mobile-frame::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 88px;
        height: 24px;
        background: #060d18;
        border-radius: 16px;
        z-index: 100;
        box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.2),
                    inset 0 0 8px rgba(0,0,0,0.5);
    }
}

/* ----- Game Canvas Container ----- */
#game-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    flex: 1;
}

#game-container canvas {
    display: block;
    border-radius: 12px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ----- Status Bar ----- */
#status-bar {
    display: none;
}

@media (min-width: 600px) {
    #status-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 22px 0;
        height: 40px;
        font-size: 8px;
        font-weight: normal;
        font-family: 'Press Start 2P', monospace;
        color: rgba(34, 197, 94, 0.7);
        letter-spacing: 1px;
        pointer-events: none;
        flex-shrink: 0;
        text-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
    }
}

/* ----- Fullscreen Confirmation Modal ----- */
#fullscreen-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 5, 15, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#fullscreen-modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.fullscreen-modal-card {
    background: rgba(10, 20, 40, 0.95);
    border: 2px solid rgba(34, 197, 94, 0.5);
    box-shadow:
        0 0 0 1px rgba(34, 197, 94, 0.15),
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 0 30px rgba(34, 197, 94, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    width: 90%;
    max-width: 320px;
    padding: 28px 24px;
    text-align: center;
    transform: scale(0.88) translateY(12px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: 'Pixelify Sans', monospace;
    position: relative;
    overflow: hidden;
}

/* Pixel scanline effect on modal */
.fullscreen-modal-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0, 0, 0, 0.04) 3px,
        rgba(0, 0, 0, 0.04) 4px
    );
    pointer-events: none;
    z-index: 0;
    border-radius: 20px;
}

#fullscreen-modal-overlay.show .fullscreen-modal-card {
    transform: scale(1) translateY(0);
}

.fullscreen-modal-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    color: #22c55e;
    margin-bottom: 16px;
    line-height: 1.6;
    text-shadow: 0 0 12px rgba(34, 197, 94, 0.5);
    position: relative;
    z-index: 1;
    letter-spacing: 1px;
}

.fullscreen-modal-body {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.82);
    margin-bottom: 28px;
    line-height: 1.6;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.fullscreen-modal-buttons {
    display: flex;
    gap: 14px;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.fullscreen-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    padding: 12px 18px;
    border-radius: 10px;
    border: 2px solid;
    cursor: pointer;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    transition: all 0.12s cubic-bezier(0.25, 0.8, 0.25, 1);
    width: 100px;
    position: relative;
    overflow: hidden;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.4);
}

.fullscreen-btn::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transform: skewX(-20deg);
}

.fullscreen-btn:hover::after {
    animation: btn-shimmer 0.4s ease forwards;
}

@keyframes btn-shimmer {
    to { left: 200%; }
}

.fullscreen-btn:active {
    transform: translateY(2px) scale(0.97);
}

.fullscreen-btn-yes {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #ffffff;
    border-color: #15803d;
    box-shadow: 0 4px 0 #14532d, 0 4px 12px rgba(34, 197, 94, 0.3);
}

.fullscreen-btn-yes:hover {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    box-shadow: 0 4px 0 #14532d, 0 6px 16px rgba(34, 197, 94, 0.4);
    transform: translateY(-1px);
}

.fullscreen-btn-yes:active {
    box-shadow: 0 1px 0 #14532d, 0 2px 6px rgba(34, 197, 94, 0.2);
    transform: translateY(3px);
}

.fullscreen-btn-no {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    border-color: #991b1b;
    box-shadow: 0 4px 0 #7f1d1d, 0 4px 12px rgba(239, 68, 68, 0.3);
}

.fullscreen-btn-no:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    box-shadow: 0 4px 0 #7f1d1d, 0 6px 16px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.fullscreen-btn-no:active {
    box-shadow: 0 1px 0 #7f1d1d, 0 2px 6px rgba(239, 68, 68, 0.2);
    transform: translateY(3px);
}

/* =====================================================
   4. GLOBAL PAGE TRANSITION OVERLAY
   ===================================================== */
#page-transition-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #060d18 0%, #0a1525 100%);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.28s ease-out;
    pointer-events: auto;
}

#page-transition-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.transition-content {
    text-align: center;
    font-family: 'Press Start 2P', monospace;
}

.transition-title {
    font-size: 8px;
    color: #22c55e;
    text-shadow: 0 0 12px rgba(34, 197, 94, 0.6), 0 0 24px rgba(34, 197, 94, 0.3);
    animation: transition-pulse 1s infinite ease-in-out;
    margin-bottom: 14px;
    letter-spacing: 2px;
}

.transition-bar-container {
    width: 120px;
    height: 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 4px;
    margin: 0 auto;
    overflow: hidden;
}

.transition-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #16a34a 0%, #22c55e 50%, #4ade80 100%);
    border-radius: 3px;
    animation: transition-fill-load 0.8s infinite linear;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

@keyframes transition-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes transition-fill-load {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* =====================================================
   5. JALUR PREVIEW BOX
   ===================================================== */
.jalur-preview-box {
    margin-top: 16px;
    width: calc(100% - 28px);
    max-width: 316px;
    background: rgba(15, 23, 42, 0.65);
    border: 1.5px solid rgba(34, 197, 94, 0.3);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.4),
        0 0 16px rgba(34, 197, 94, 0.08),
        inset 0 1px 0 rgba(255,255,255,0.04);
    border-radius: 16px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-sizing: border-box;
    z-index: 12;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.jalur-preview-box .preview-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #22c55e;
    margin-bottom: 6px;
    letter-spacing: 1px;
    text-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.jalur-preview-box .canvas-container {
    width: 260px;
    height: 70px;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1.5px solid rgba(34, 197, 94, 0.2);
}

.jalur-preview-box .canvas-container canvas {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.jalur-preview-box .preview-name {
    font-family: 'Pixelify Sans', monospace;
    font-size: 13px;
    font-weight: bold;
    color: #f59e0b;
    margin-top: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

/* =====================================================
   6. SCROLLABLE HELPER
   ===================================================== */
.scrollable {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y !important;
}