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

body,
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
    background-color: #0b0f0b;
    /* Very dark bog green/black */
    font-family: 'Roboto', sans-serif;
    color: #e0e0e0;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 600px;
    /* Playable on desktop too */
    margin: 0 auto;
    background-color: #0a0c0a;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

#bg-layer {
    position: absolute;
    top: 0;
    left: -15%;
    /* Allow room for panning */
    width: 130%;
    /* Wider than canvas */
    height: 100%;
    /* Static sunny background image */
    background: url('assets/sunny_bg.png') no-repeat center bottom;
    /* Align to bottom, better for track connection */
    background-size: cover;
    z-index: 1;
    /* Behind canvas */
    transition: transform 0.1s linear;
    /* Smooth panning */
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
    z-index: 2;
    /* In front of bg */
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    /* Let gameplay clicks pass through */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#hud {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
}

.hud-item {
    font-family: 'Rye', cursive;
    /* Industrial / old-timey font */
    text-shadow: 2px 2px 0 #000;
}

.score-box {
    font-size: 1.5rem;
    color: #d4a373;
    /* Rusty gold */
    display: flex;
    align-items: baseline;
    gap: 10px;
}

#multiplier {
    font-size: 1rem;
    color: #ff5555;
    /* Alert red */
}

.meter-container label {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 3px;
    text-shadow: 1px 1px 0 #000;
}

.meter-bar-wrapper {
    width: 150px;
    height: 10px;
    background-color: #222;
    border: 1px solid #000;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.meter-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #4b3621, #8b5a2b);
    /* Peat color */
    transition: width 0.2s, background-color 0.2s;
}

@keyframes blinkRed {
    0% {
        background: #ff2222;
        box-shadow: 0 0 10px #ff2222;
    }

    50% {
        background: #4b3621;
        box-shadow: none;
    }

    100% {
        background: #ff2222;
        box-shadow: 0 0 10px #ff2222;
    }
}

.blink-warning {
    animation: blinkRed 0.5s infinite;
}

.health-fill {
    background: linear-gradient(90deg, #500000, #ff2222);
    /* Dark red to bright red */
}

/* MENUS */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(5, 8, 5, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    /* Re-enable for buttons */
}

.hidden {
    display: none !important;
}

.panel {
    background: url('assets/peat.png') center/cover;
    position: relative;
    padding: 30px;
    border: 4px solid #3a2a1a;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9), inset 0 0 50px rgba(0, 0, 0, 0.8);
    max-width: 90%;
}

/* Darken the panel bg so text is readable */
.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 10, 5, 0.85);
    border-radius: 4px;
    z-index: 0;
}

.panel>* {
    position: relative;
    z-index: 1;
}

.logo {
    width: 90%;
    max-width: 320px;
    margin: 0 auto 15px auto;
    display: block;
    filter: invert(1) brightness(2);
    /* Makes the black logo white to stand out */
}

h1,
h2 {
    font-family: 'Creepster', cursive;
    color: #c98c53;
    text-shadow: 3px 3px 0 #000, 0 0 10px rgba(255, 100, 0, 0.5);
    line-height: 1.1;
}

h1 {
    font-size: 3.5rem;
    margin-bottom: 5px;
}

h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.subtitle {
    font-family: 'Rye', cursive;
    color: #888;
    margin-bottom: 25px;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.instructions {
    background-color: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border: 1px solid #222;
    margin-bottom: 25px;
    font-size: 0.95rem;
    line-height: 1.4;
    border-radius: 4px;
}

.icon {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 8px;
    filter: drop-shadow(1px 1px 0 #000);
}

.controls-hint {
    font-size: 0.8rem;
    color: #666;
    margin-top: 15px;
    font-style: italic;
}

button {
    background: linear-gradient(to bottom, #7a4b24, #4a2a10);
    color: #e0c090;
    border: 2px solid #2a1a08;
    padding: 15px 40px;
    font-size: 1.5rem;
    font-family: 'Rye', cursive;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    box-shadow: 0 4px 0 #1a0a00, 0 8px 15px rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
}

button:hover {
    background: linear-gradient(to bottom, #8a5b34, #5a3a1f);
    color: #fff;
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1a0a00, 0 4px 10px rgba(0, 0, 0, 0.5);
}

button:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* HIGHSCORE SYSTEM */
.final-score-text {
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#share-btn {
    background: linear-gradient(to bottom, #2c5a2c, #1a3a1a);
    border-color: #0f1a0f;
}

#share-btn:hover {
    background: linear-gradient(to bottom, #3c6a3c, #2a4a2a);
}