@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@500;800;900&display=swap');

:root {
    --primary: #f48fb1;
    --secondary: #ce93d8;
    --accent: #ffb74d;
    --text: #4e342e;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #81c784; /* Fallback */
    font-family: 'M PLUS Rounded 1c', sans-serif;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

#root {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* UI Overlays */
.ui-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px;
    z-index: 10;
}

/* Start Screen */
.start-screen {
    position: absolute;
    inset: 0;
    background: #f8dcec;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    pointer-events: auto;
}

.start-content {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 0;
    text-align: center;
}

.title-screen-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.btn-main {
    background: linear-gradient(135deg, var(--primary), #ec407a);
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 999px;
    font-size: 1.25rem;
    font-weight: 900;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 6px 0 #c2185b, 0 15px 25px rgba(236, 64, 122, 0.3);
    transition: transform 0.1s, box-shadow 0.1s;
    width: 100%;
}

.title-screen-button {
    position: absolute;
    left: 50%;
    bottom: 7.5%;
    transform: translateX(-50%);
    width: min(38vw, 650px);
    height: 19%;
    opacity: 0;
}

.title-screen-button:active {
    transform: translateX(-50%) scale(.98);
}

@media (max-width: 720px), (orientation: portrait) {
    .start-screen {
        padding: 16px;
        box-sizing: border-box;
        background: linear-gradient(180deg, #e8d8ff 0%, #ffdce9 46%, #fff1ce 100%);
    }

    .start-content {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 18px;
        height: auto;
    }

    .title-screen-image {
        width: 100%;
        height: auto;
        max-height: calc(100vh - 112px);
        object-fit: contain;
        border-radius: 20px;
        box-shadow: 0 18px 42px rgba(107, 68, 103, .18);
    }

    .title-screen-button {
        position: static;
        transform: none;
        width: min(86vw, 420px);
        height: auto;
        margin: 0 auto;
        padding: 14px 30px;
        opacity: 1;
    }

    .title-screen-button:active {
        transform: translateY(3px);
    }
}
.btn-main:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #c2185b;
}

/* HUD */
.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.hud-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 14px 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 20px;
    pointer-events: auto;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.stat-val {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--text);
}

.btn-upgrade {
    background: linear-gradient(135deg, var(--accent), #ff9800);
    color: #fff;
    border: none;
    padding: 18px 32px;
    border-radius: 999px;
    font-size: 1.2rem;
    font-weight: 900;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 6px 0 #e65100, 0 15px 30px rgba(255, 152, 0, 0.4);
    pointer-events: auto;
    transition: transform 0.1s;
    align-self: center;
    border: 2px solid rgba(255, 255, 255, 0.4);
    animation: pulseGlow 2s infinite alternate;
}

@keyframes pulseGlow {
    from { box-shadow: 0 6px 0 #e65100, 0 5px 15px rgba(255, 152, 0, 0.3); }
    to { box-shadow: 0 6px 0 #e65100, 0 15px 40px rgba(255, 152, 0, 0.6); }
}

.btn-upgrade:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #e65100;
    animation: none;
}

.notif {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 10px 24px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 1rem;
    pointer-events: none;
    animation: fadeUp 2s forwards;
    z-index: 100;
}

@keyframes fadeUp {
    0% { opacity: 0; transform: translate(-50%, 20px); }
    10% { opacity: 1; transform: translate(-50%, 0); }
    80% { opacity: 1; transform: translate(-50%, -10px); }
    100% { opacity: 0; transform: translate(-50%, -30px); }
}

.hud-info {
    font-size: 0.9rem;
    color: white;
    background: rgba(0,0,0,0.4);
    padding: 8px 16px;
    border-radius: 999px;
    align-self: flex-start;
    backdrop-filter: blur(4px);
    pointer-events: auto;
}

/* Joystick */
.joystick-zone {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    pointer-events: auto;
    touch-action: none;
}
.joystick-base {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: relative;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.joystick-stick {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
