/* ============================================
   CHUNPAN CHASE - Ghibli Edition (Mobile Ready)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: #1a1410;
    background-image:
        radial-gradient(ellipse at 70% 20%, rgba(255,202,40,0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 80%, rgba(91,192,235,0.04) 0%, transparent 50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'Merriweather', 'Georgia', serif;
    overflow: hidden;
    color: #e8d5b7;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

.game-container {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    box-shadow:
        0 0 50px rgba(255,202,40,0.08),
        0 8px 40px rgba(0,0,0,0.5),
        inset 0 0 0 1px rgba(255,248,225,0.08);
    background: #111;
    max-width: 100vw;
}

canvas {
    display: block;
    image-rendering: auto;
    touch-action: none;
}

/* Fullscreen Button */
.fs-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255,248,225,0.2);
    background: rgba(40,32,22,0.7);
    color: #e8d5b7;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    backdrop-filter: blur(4px);
}
.fs-btn:hover {
    background: rgba(255,202,40,0.3);
    border-color: rgba(255,202,40,0.5);
    transform: scale(1.1);
}
.fs-btn:active { transform: scale(0.95); }

.audio-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 44px;
    height: 44px;
    background: rgba(25, 20, 15, 0.6);
    color: #FFCA28;
    border: 2px solid rgba(255, 202, 40, 0.2);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
}
.audio-btn:hover {
    background: rgba(255, 202, 40, 0.3);
    border-color: rgba(255, 202, 40, 0.5);
    transform: scale(1.1);
}
.audio-btn:active { transform: scale(0.95); }

.game-title {
    text-align: center;
    margin-bottom: 12px;
}

.game-title h1 {
    font-size: 26px;
    font-weight: 700;
    font-family: 'Playfair Display', 'Georgia', serif;
    background: linear-gradient(135deg, #FFCA28, #FF8F00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
    filter: drop-shadow(0 2px 8px rgba(255,202,40,0.2));
}

.game-title p {
    font-size: 13px;
    color: #8d7e6e;
    margin-top: 4px;
    font-weight: 400;
    font-style: italic;
}

.controls-hint {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

.control-key {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #8d7e6e;
}

.control-key kbd {
    background: #2a2218;
    border: 1px solid #4a3f32;
    border-radius: 5px;
    padding: 2px 8px;
    font-size: 11px;
    font-family: 'Outfit', monospace;
    color: #e8d5b7;
    box-shadow: 0 2px 0 #1a1410;
}

/* ============================================
   MOBILE TOUCH CONTROLS
   ============================================ */

.mobile-controls {
    display: none;
    gap: 20px;
    justify-content: center;
    align-items: center;
    margin-top: 14px;
    padding: 0 20px;
    width: 100%;
    max-width: 500px;
}

.mobile-btn {
    flex: 1;
    max-width: 140px;
    height: 72px;
    border-radius: 16px;
    border: 2px solid rgba(255,248,225,0.15);
    background: rgba(40,32,22,0.6);
    color: #e8d5b7;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.1s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mobile-btn small {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    opacity: 0.7;
}

.mobile-btn:active, .mobile-btn.active {
    transform: scale(0.93);
    background: rgba(255,202,40,0.25);
    border-color: rgba(255,202,40,0.5);
}

.jump-btn {
    border-color: rgba(102,187,106,0.3);
}
.jump-btn:active {
    background: rgba(102,187,106,0.25);
    border-color: rgba(102,187,106,0.5);
}

.slide-btn {
    border-color: rgba(66,165,245,0.3);
}
.slide-btn:active {
    background: rgba(66,165,245,0.25);
    border-color: rgba(66,165,245,0.5);
}

/* ============================================
   FULLSCREEN
   ============================================ */
.game-container:fullscreen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0805;
    border-radius: 0;
}
.game-container:fullscreen canvas {
    border-radius: 0;
    max-width: 100vw;
    max-height: 100vh;
}
.game-container:fullscreen .fs-btn {
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    font-size: 22px;
}

/* ============================================
   RESPONSIVE / MOBILE
   ============================================ */

/* Show mobile controls on touch devices / narrow screens */
@media (max-width: 920px), (hover: none) and (pointer: coarse) {
    .game-title h1 { font-size: 22px; letter-spacing: 1px; }
    .game-title p { font-size: 11px; }
    .game-title { margin-bottom: 8px; }

    .game-container {
        border-radius: 8px;
        width: 100vw;
        max-width: 100vw;
    }

    canvas {
        width: 100vw !important;
        height: auto !important;
    }

    .desktop-only { display: none !important; }

    .mobile-controls { display: flex; }

    .fs-btn {
        width: 32px; height: 32px;
        font-size: 14px;
        bottom: 6px; right: 6px;
    }
}

@media (max-width: 480px) {
    .game-title h1 { font-size: 18px; }
    .game-title { margin-bottom: 4px; }
    .mobile-btn { height: 60px; max-width: 120px; font-size: 24px; border-radius: 12px; }
    .mobile-controls { gap: 14px; margin-top: 10px; }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .game-title { display: none; }
    .mobile-controls {
        position: fixed;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 100;
        margin-top: 0;
    }
    .mobile-btn {
        height: 50px;
        max-width: 100px;
        font-size: 20px;
        background: rgba(40,32,22,0.8);
    }
    body { justify-content: flex-start; }
}

/* Extra large screens */
@media (min-width: 1200px) {
    .game-container { border-radius: 18px; }
}
