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

:root {
    --bg-color: #fcfcfc;
    --bg-grid: #f0e9d6;
    --primary: #84b22b;
    --accent: #9b6f00;
    --ui-font: 'Fredoka One', cursive, sans-serif;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #222;
    font-family: var(--ui-font);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 640px; /* Base aspect ratio width */
    margin: 0 auto;
    background: linear-gradient(to bottom, #fcfcfc, #f0e9d6);
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* SVG Game World */
svg#game-world {
    display: block;
    width: 100%;
    height: 100%;
    /* Maintain aspect ratio logic handled in JS or via viewBox */
}

/* UI Overlays */
.ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to game usually */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s;
}

.screen {
    pointer-events: auto;
    text-align: center;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.27), opacity 0.4s;
}

.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
}

h1 {
    font-size: 4rem;
    color: var(--accent);
    margin: 0 0 20px 0;
    text-shadow: 2px 2px 0px #fff, 4px 4px 0px rgba(0,0,0,0.1);
}

.score-display {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 10px;
}

.score-sub {
    font-size: 1.2rem;
    color: #555;
    margin-bottom: 30px;
}

.hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 10px 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
}

.hud-score {
    font-size: 24px;
    color: var(--accent);
    font-weight: bold;
}

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.5rem;
    font-family: var(--ui-font);
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 0 #5a7d18, 0 8px 10px rgba(0,0,0,0.2);
    transition: transform 0.1s, box-shadow 0.1s;
    margin: 10px;
    position: relative;
    overflow: hidden;
}

button:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #5a7d18, 0 4px 5px rgba(0,0,0,0.2);
}

.btn-small {
    padding: 10px 20px;
    font-size: 1rem;
    background: #9b6f00;
    box-shadow: 0 4px 0 #6e4f00, 0 6px 8px rgba(0,0,0,0.2);
}

.btn-small:active {
    box-shadow: 0 0 0 #6e4f00, 0 3px 4px rgba(0,0,0,0.2);
}

.btn-row {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

/* Toggle Button Styles */
.toggle-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.toggle-off {
    background: #ccc;
    box-shadow: 0 4px 0 #999;
}
.toggle-off:active {
    box-shadow: 0 0 0 #999;
}

/* Grid Background Pattern */
.bg-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.5;
}
