:root {
    --primary-color: #D72638;
    /* Red */
    --secondary-color: #F49F1C;
    /* Gold */
    --bg-color: #1A1A1D;
    --text-color: #FFFFFF;
    --font-family: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
    /* Prevent default touch actions like scrolling */
}

.game-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #87CEEB 0%, #E0F7FA 100%);
    /* Day sky */
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    touch-action: none;
    /* Critical: Disable browser handling of gestures */
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    /* Allow clicks to pass through to canvas if no screen is active */
}

#score-board {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    /* Hidden screens don't block clicks */
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
    z-index: 20;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
    /* Active screen captures clicks */
}

h1 {
    font-size: 48px;
    color: var(--secondary-color);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
}

h2 {
    font-size: 36px;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

p {
    font-size: 18px;
    margin-bottom: 30px;
    color: #eee;
}

button {
    padding: 12px 30px;
    font-size: 20px;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: var(--font-family);
    margin: 10px;
    pointer-events: auto;
    /* Ensure buttons are clickable */
    position: relative;
    z-index: 30;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-gold {
    background: var(--secondary-color);
    color: #333;
}

/* Avatar Frame Preview */
.avatar-preview {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
}

.avatar-frame {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 50%;
    overflow: hidden;
}

#user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.frame-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 8px solid var(--secondary-color);
    border-radius: 50%;
    box-sizing: border-box;
    background: radial-gradient(circle, transparent 60%, rgba(215, 38, 56, 0.2) 70%, var(--primary-color) 100%);
    box-shadow: 0 0 20px var(--secondary-color);
}

.frame-overlay::after {
    content: '★';
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--secondary-color);
    font-size: 24px;
}

@media (max-width: 600px) {
    h1 {
        font-size: 32px;
    }

    h2 {
        font-size: 28px;
    }
}

/* Mobile Jump Button */
.jump-btn-overlay {
    display: none;
    /* Hidden on Desktop */
    position: absolute;
    bottom: 20px;
    right: 20px;
    /* Safe area for thumb */
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(215, 38, 56, 0.6);
    /* Red tint */
    border: 3px solid rgba(255, 255, 255, 0.8);
    color: white;
    font-size: 14px;
    font-weight: bold;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    touch-action: manipulation;
    /* Optimizes for touch */
    align-items: center;
    justify-content: center;
    flex-direction: column;
    pointer-events: auto;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.jump-btn-overlay:active {
    transform: scale(0.95);
    background: rgba(215, 38, 56, 0.8);
}

/* Show on Mobile & Tablet */
@media (max-width: 1024px) {
    .jump-btn-overlay {
        display: flex;
    }
}