* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background: radial-gradient(circle at 50% 25%, #2a160f 0%, #0d0503 100%);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 24px 16px 60px 16px;
    font-family: 'Press Start 2P', cursive;
    color: #f8fafc;
}

.game-wrapper {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 150% Scaled Arcade Game Container (1200x600) */
#game-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    aspect-ratio: 2 / 1;
    background-color: #1a0f0b;
    border: 5px solid #c88846;
    border-radius: 12px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.85), 0 0 30px rgba(200, 136, 70, 0.25);
    overflow: hidden;
    touch-action: none;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* HUD Header (Scaled 130%) */
#hudHeader {
    position: absolute;
    top: 18px;
    left: 0;
    width: 100%;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    pointer-events: none;
}

.hud-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.heat-meter-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(20, 10, 8, 0.9);
    border: 2px solid #c88846;
    padding: 8px 14px;
    border-radius: 8px;
    box-shadow: 3px 3px 0 #000;
}

.heat-label {
    font-size: 11px;
    color: #ffdfba;
    letter-spacing: 1px;
}

.meter-track {
    width: 130px;
    height: 15px;
    background: #2a1510;
    border: 1px solid #7c4424;
    border-radius: 3px;
    overflow: hidden;
}

#heatFill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ff4500, #ffaa00);
    transition: width 0.1s linear;
}

.heat-percent {
    font-size: 10px;
    color: #fff;
    min-width: 40px;
}

.hud-right {
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
}

.score-box {
    background: rgba(20, 10, 8, 0.9);
    border: 2px solid #c88846;
    padding: 8px 16px;
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    line-height: 1.6;
    text-align: right;
    box-shadow: 3px 3px 0 #000;
}

.score-val {
    color: #ffcc00;
}

.pixel-btn-icon {
    background: #3e1e12;
    border: 2px solid #c88846;
    color: #fff;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 3px 3px 0 #000;
    border-radius: 6px;
}

.pixel-btn-icon:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 #000;
}

/* Modals */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(22, 11, 8, 0.92);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 20;
    padding: 20px;
}

.overlay.hidden {
    display: none;
}

.pixel-card {
    border: 4px solid #c88846;
    background: rgba(36, 18, 12, 0.96);
    padding: 30px 36px;
    border-radius: 12px;
    box-shadow: 8px 8px 0 #000;
    max-width: 600px;
    width: 95%;
}

h1 {
    color: #ffdfba;
    font-size: 26px;
    margin-bottom: 18px;
    text-shadow: 3px 3px 0 #4a2114;
    letter-spacing: 1px;
}

p {
    color: #e6ccb2;
    font-size: 11px;
    line-height: 1.8;
    margin-bottom: 14px;
    text-shadow: 1px 1px 0 #000;
}

.sub-tip {
    color: #e09f67;
    font-size: 10px;
}

button.action-btn {
    margin-top: 16px;
    padding: 14px 32px;
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    background-color: #c88846;
    color: #1a0802;
    border: 3px solid #ffe8d6;
    cursor: pointer;
    box-shadow: 5px 5px 0 #000;
    border-radius: 6px;
    transition: background 0.1s;
}

button.action-btn:active {
    transform: translate(3px, 3px);
    box-shadow: 2px 2px 0 #000;
}

.back-link {
    display: inline-block;
    margin-top: 16px;
    color: #9c6644;
    font-size: 9px;
    text-decoration: none;
}

.back-link:hover {
    color: #ffdfba;
}

/* Game Info / Rules Section under the Game (Styled like Jumping Eggplants) */
.game-info-section {
    margin-top: 36px;
    width: 100%;
    max-width: 1040px;
    background: rgba(25, 13, 8, 0.75);
    border: 2px solid #5a2f1a;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    color: #f1e3d3;
    line-height: 1.65;
    text-align: left;
}

.game-info-section h2 {
    font-family: 'Press Start 2P', cursive;
    color: #ffdfba;
    font-size: 16px;
    margin-top: 24px;
    margin-bottom: 12px;
    border-bottom: 2px solid rgba(200, 136, 70, 0.3);
    padding-bottom: 8px;
    letter-spacing: 0.5px;
}

.game-info-section h2:first-child {
    margin-top: 0;
}

.game-info-section p {
    font-family: system-ui, -apple-system, Segoe UI, sans-serif;
    color: #e6ccb2;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
    text-shadow: none;
}

.rules-list {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.rules-list li {
    background: rgba(45, 22, 14, 0.6);
    border: 1px solid rgba(200, 136, 70, 0.25);
    border-radius: 8px;
    padding: 14px;
    font-size: 13px;
    color: #f5ebe0;
}

.rules-list li strong {
    color: #ffd700;
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

/* Mobile Jump Bar (Hidden by default on desktop) */
.mobile-jump-bar {
    display: none;
}

@media (max-width: 768px) {
    body {
        padding: 0;
        overflow: hidden;
        background-color: #000;
    }
    .game-wrapper {
        position: fixed;
        top: 0;
        left: 0;
        width: 100dvw;
        height: 100dvh;
        z-index: 9999;
        margin: 0;
        padding: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        background: #000;
        max-width: none;
    }
    #game-container {
        width: 100dvw;
        height: 100dvh;
        max-width: none;
        max-height: none;
        border: none;
        border-radius: 0;
    }

    .game-info-section, .site-footer {
        display: none !important;
    }

    /* Dedicated Mobile Jump Button */
    .mobile-jump-bar {
        position: absolute;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        z-index: 10001;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 13px 16px;
        background: linear-gradient(180deg, #d48b47 0%, #a45d25 100%);
        color: #fff;
        font-family: 'Press Start 2P', cursive;
        font-size: 11px;
        letter-spacing: 0.5px;
        border: 2px solid #ffdfba;
        border-radius: 8px;
        box-shadow: 0 4px 0 #4a2114, 0 6px 12px rgba(0, 0, 0, 0.6);
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.05s, box-shadow 0.05s;
    }
    .mobile-jump-bar:active {
        transform: translateX(-50%) translateY(2px);
        box-shadow: 0 2px 0 #4a2114;
        background: linear-gradient(180deg, #e09f67 0%, #b86e30 100%);
    }

    /* Compact Mobile HUD */
    #hudHeader {
        top: 6px;
        padding: 0 8px;
    }
    .hud-left {
        gap: 6px;
    }
    .heat-meter-box {
        padding: 4px 6px;
        gap: 4px;
        border-width: 1.5px;
        border-radius: 6px;
        box-shadow: 2px 2px 0 #000;
    }
    .meter-track {
        width: 60px;
        height: 10px;
        border-radius: 2px;
    }
    .heat-label {
        font-size: 7.5px;
    }
    .heat-percent {
        font-size: 7.5px;
        min-width: 24px;
    }
    .hud-right {
        gap: 6px;
    }
    .score-box {
        padding: 4px 8px;
        font-size: 8px;
        line-height: 1.35;
        border-width: 1.5px;
        border-radius: 6px;
        box-shadow: 2px 2px 0 #000;
    }
    .pixel-btn-icon {
        padding: 4px 7px;
        font-size: 11px;
        border-width: 1.5px;
        border-radius: 5px;
        box-shadow: 2px 2px 0 #000;
    }

    /* Compact Modal Cards (Never clipped on small screens) */
    .overlay {
        padding: 8px;
    }
    .pixel-card {
        padding: 12px 14px;
        border-width: 2.5px;
        border-radius: 8px;
        box-shadow: 4px 4px 0 #000;
        max-width: 96%;
    }
    h1 {
        font-size: 15px;
        margin-bottom: 6px;
        text-shadow: 2px 2px 0 #4a2114;
    }
    p {
        font-size: 8.5px;
        line-height: 1.45;
        margin-bottom: 6px;
    }
    .sub-tip {
        font-size: 7px;
        line-height: 1.4;
        margin-bottom: 6px;
    }
    button.action-btn {
        margin-top: 6px;
        padding: 8px 18px;
        font-family: 'Press Start 2P', cursive;
        font-size: 11px;
        border-width: 2px;
        box-shadow: 3px 3px 0 #000;
    }
    .back-link {
        margin-top: 6px;
        font-size: 8px;
    }

    /* Guide section on mobile */
    .game-info-section {
        margin-top: 20px;
        padding: 16px;
    }
    .rules-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .rules-list li {
        padding: 10px;
        font-size: 12px;
    }
}

/* Mobile Auto-Flip for Portrait */
@media (max-width: 768px) and (orientation: portrait) {
    .game-wrapper {
        transform: rotate(90deg);
        transform-origin: center center;
        width: 100dvh;
        height: 100dvw;
        position: fixed;
        top: 50%;
        left: 50%;
        margin-top: -50dvw;
        margin-left: -50dvh;
    }
    #game-container {
        width: 100%;
        height: 100%;
    }
    .mobile-jump-bar {
        bottom: 20px;
        width: 80%;
    }
}

/* Ko-fi Footer */
.site-footer {
    text-align: center;
    padding: 24px 16px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}
.kofi-footer-container {
    margin: 10px 0;
    display: flex;
    justify-content: center;
    width: 100%;
}
.kofi-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #000000 !important;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    padding: 10px 24px;
    border-radius: 9999px;
    text-decoration: none;
    box-shadow: 0 4px 18px rgba(245, 158, 11, 0.4);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.35);
}
.kofi-button:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 26px rgba(245, 158, 11, 0.6);
    filter: brightness(1.05);
}
.kofi-icon {
    font-size: 1.2rem;
    display: inline-block;
    animation: kofi-wiggle 3.5s ease-in-out infinite;
    transform-origin: bottom center;
}
@keyframes kofi-wiggle {
    0%, 82%, 100% { transform: rotate(0deg); }
    86% { transform: rotate(-12deg); }
    90% { transform: rotate(10deg); }
    94% { transform: rotate(-6deg); }
    97% { transform: rotate(4deg); }
}
