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

:root {
    --bg-color: #F3E5F5;
    --road-color: #ffffff;
    --lane-color: #E1BEE7;
    --primary-color: #F48FB1;
    --accent-color: #80CBC4;
    --text-color: #4A4A4A;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    font-family: 'Fredoka', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Prevents scrollbars */
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    height: 100%;
    max-height: 900px;
    background-color: #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: var(--road-color);
    /* IMPORTANT: Disables browser handling of gestures (scrolling/zooming) */
    touch-action: none;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* --- RESPONSIVE LOGOS --- */
#game-logo {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 90px;
    height: auto;
    z-index: 20;
    transition: width 0.3s ease; /* Smooth resizing */
}

#game-logo-right {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 70px;
    height: auto;
    z-index: 20;
    transition: width 0.3s ease;
}

/* HUD */
#hud {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    padding-top: 110px; /* Default top padding for desktop */
    pointer-events: none;
    flex-wrap: wrap;
    transition: padding-top 0.3s ease;
}

.stat-box {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    text-align: center;
    color: var(--text-color);
    margin-bottom: 5px;
}

.label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 2px;
}

#mood-display { font-size: 24px; }
#score-display, #distance-display { font-weight: 600; font-size: 18px; }

.balance-container {
    width: 100%;
    margin-top: 10px;
    background: rgba(255,255,255,0.9);
    padding: 10px;
    border-radius: 15px;
}

.balance-bar-bg {
    width: 100%;
    height: 10px;
    background: #eee;
    border-radius: 5px;
    overflow: hidden;
}

#balance-fill {
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, #FFCDD2, #A5D6A7);
    transition: width 0.3s ease;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(243, 229, 245, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

.hidden { display: none !important; }

.title {
    font-size: 42px;
    color: var(--primary-color);
    margin-bottom: 10px;
    text-shadow: 2px 2px 0px #fff;
}

.mascot-preview {
    font-size: 80px;
    margin: 20px 0;
    animation: bounce 2s infinite;
}

button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 20px;
    font-family: 'Fredoka', sans-serif;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 0 #4DB6AC;
    transition: transform 0.1s;
    margin-top: 20px;
}

button:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #4DB6AC;
}

.tip-box {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    border: 2px solid var(--primary-color);
    color: var(--text-color);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* --- MOBILE BREAKPOINTS --- */
/* For screens smaller than 600px (most phones) */
@media screen and (max-width: 600px) {
    /* Shrink logos */
    #game-logo { width: 70px; top: 10px; left: 10px; }
    #game-logo-right { width: 55px; top: 10px; right: 10px; }
    
    /* Pull HUD up slightly since logos are smaller */
    #hud { padding-top: 80px; padding-left: 10px; padding-right: 10px; }
    
    /* Make stats smaller to fit side-by-side */
    .stat-box { padding: 5px 10px; }
    #mood-display { font-size: 20px; }
    #score-display, #distance-display { font-size: 16px; }
    
    .title { font-size: 32px; }
}

/* For very small screens (iPhone SE, etc.) */
@media screen and (max-width: 350px) {
    #hud { padding-top: 70px; }
    #game-logo { width: 60px; }
    #game-logo-right { width: 45px; }
    .stat-box { font-size: 12px; }
}