/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

body {
    background-color: #0d0f0d;
    color: #f7ede2;
    font-family: 'Outfit', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

/* Game Shell Container (Portrait 9:16 aspect ratio) */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 450px;
    max-height: 800px;
    background-color: #171d18;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.7), 0 0 100px rgba(132, 204, 22, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    border: 1px solid rgba(132, 204, 22, 0.15);
}

@media (max-width: 480px) {
    #game-container {
        border-radius: 0;
        border: none;
    }
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: none;
}

/* HUD Styling */
#hud {
    position: absolute;
    top: 16px;
    left: 12px;
    right: 12px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    z-index: 10;
    pointer-events: none;
}

.hud-item {
    background: rgba(23, 29, 24, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(132, 204, 22, 0.3);
    border-radius: 10px;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.hud-label {
    font-size: 10px;
    font-weight: 800;
    color: rgba(247, 237, 226, 0.6);
    letter-spacing: 1.5px;
    margin-bottom: 2px;
}

.hud-value {
    font-size: 15px;
    font-weight: 700;
    color: #eab308;
    font-family: 'Fredoka', sans-serif;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Floating Buttons */
.hud-btn {
    position: absolute;
    top: 80px;
    right: 12px;
    z-index: 10;
    background: rgba(23, 29, 24, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(132, 204, 22, 0.3);
    color: #eab308;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.hud-btn:hover {
    transform: scale(1.1);
    background: #eab308;
    color: #171d18;
}

/* Screens / Overlays */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 15, 13, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px;
    z-index: 20;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

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

.screen.active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

/* Game Title styling */
.game-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 44px;
    line-height: 0.95;
    text-align: center;
    color: #f7ede2;
    text-shadow: 0 4px 0px #15803d, 0 8px 20px rgba(0, 0, 0, 0.6);
    margin-bottom: 8px;
    letter-spacing: 1px;
    animation: titleGlow 2.5s infinite alternate;
}

.game-title span {
    color: #eab308;
    font-size: 58px;
}

.game-subtitle {
    font-size: 14px;
    color: rgba(247, 237, 226, 0.75);
    margin-bottom: 36px;
    text-align: center;
    letter-spacing: 0.5px;
}

/* Menu & Stat Cards */
.menu-card, .stats-card {
    background: rgba(23, 29, 24, 0.95);
    border: 2px solid rgba(132, 204, 22, 0.4);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.6);
    margin-bottom: 24px;
}

.high-score-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(247, 237, 226, 0.15);
    padding-top: 12px;
    font-size: 13px;
    font-weight: 800;
    color: rgba(247, 237, 226, 0.5);
}

#high-score-val {
    color: #eab308;
    font-size: 16px;
}

/* Instructions */
.instructions {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.instructions h3 {
    font-size: 11px;
    letter-spacing: 2px;
    color: #eab308;
    margin-bottom: 4px;
    text-align: center;
}

.instructions p {
    font-size: 12px;
    color: rgba(247, 237, 226, 0.7);
    line-height: 1.4;
}

/* Buttons */
.btn {
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 17px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    letter-spacing: 1px;
}

.primary-btn {
    background: linear-gradient(135deg, #a3e635, #65a30d);
    color: #171d18;
    border-bottom: 4px solid #4d7c0f;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(101, 163, 13, 0.4);
    filter: brightness(1.1);
}

.primary-btn:active {
    transform: translateY(2px);
    border-bottom: 0px solid transparent;
}

.secondary-btn {
    background: rgba(247, 237, 226, 0.07);
    color: #f7ede2;
    border: 1px solid rgba(247, 237, 226, 0.15);
}

.secondary-btn:hover {
    background: rgba(247, 237, 226, 0.12);
    transform: translateY(-2px);
}

/* Stats */
.stats-card p {
    font-size: 16px;
    color: rgba(247, 237, 226, 0.8);
    display: flex;
    justify-content: space-between;
}

.stat-highlight {
    font-weight: 700;
    color: #eab308;
    font-family: 'Fredoka', sans-serif;
}

.text-gold {
    color: #eab308 !important;
    font-family: 'Fredoka', sans-serif;
    font-size: 30px;
    text-shadow: 0 4px 10px rgba(234, 179, 8, 0.3);
}

.text-red {
    color: #ef4444 !important;
    font-family: 'Fredoka', sans-serif;
    font-size: 30px;
    text-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

.screen-title {
    font-size: 30px;
    text-align: center;
    margin-bottom: 24px;
}

/* Animations */
@keyframes titleGlow {
    from {
        text-shadow: 0 4px 0px #15803d, 0 8px 20px rgba(0, 0, 0, 0.6);
    }
    to {
        text-shadow: 0 4px 0px #15803d, 0 8px 30px rgba(163, 230, 53, 0.4);
    }
}
