/* ==========================================================================
   Fairy Garden - Cute Pastel Stylesheet
   ========================================================================== */

:root {
    --bg-color: #f7e6f8; /* Soft pastel pink/purple background */
    --panel-bg: rgba(255, 255, 255, 0.8);
    --panel-border: rgba(255, 182, 193, 0.5); /* Pastel pink */
    --fairy-pink: #ff7ebb;
    --fairy-yellow: #fff37a;
    --fairy-blue: #7ee8ff;
    --fairy-green: #90f39f;
    --fairy-orange: #ffb86c;
    --text-color: #5c4760;
    --font-primary: 'M PLUS Rounded 1c', 'Fredoka', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.6) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 230, 240, 0.8) 0%, transparent 50%);
    color: var(--text-color);
    font-family: var(--font-primary);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Container */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: #eef9ff; /* Soft sky blue */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Canvas */
#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Pastel Panels */
.pastel-panel {
    background: var(--panel-bg);
    border: 3px solid var(--panel-border);
    box-shadow: 0 8px 24px rgba(255, 182, 193, 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* HUD Overlay */
#hud {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    height: 65px;
    z-index: 10;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
}

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

.hud-item .label {
    font-size: 0.75rem;
    font-weight: 800;
    color: #927599;
    margin-bottom: 2px;
}

.hud-item .value {
    font-size: 1.25rem;
    font-weight: 900;
}

/* Pop colors */
.text-pink {
    color: var(--fairy-pink);
    text-shadow: 1px 1px 0 #fff, 0 0 8px rgba(255, 126, 187, 0.3);
}

.text-orange {
    color: #ff8c42;
    text-shadow: 1px 1px 0 #fff;
}

.bubble-text {
    color: var(--fairy-pink);
    text-shadow: 
        3px 3px 0 #fff,
        -1px -1px 0 #fff,  
        1px -1px 0 #fff,
        -1px 1px 0 #fff,
        1px 1px 0 #fff,
        4px 4px 10px rgba(255, 126, 187, 0.4);
    font-weight: 900;
}

/* Hearts / Power */
#hearts {
    display: flex;
    gap: 8px;
}

.heart {
    font-size: 1.3rem;
    filter: grayscale(100%) opacity(0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.heart.active {
    filter: none;
    transform: scale(1.15) rotate(5deg);
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1.1); }
    to { transform: scale(1.2) rotate(-5deg); }
}

/* Screens / Overlays */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(253, 245, 250, 0.8);
    padding: 20px;
}

.overlay-screen.active {
    display: flex;
}

.screen-content {
    max-width: 500px;
    width: 100%;
    border-radius: 28px;
    padding: 30px;
    text-align: center;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 5px solid #fff;
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.screen-content h1 {
    font-size: 3.2rem;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.screen-content h2 {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.subtitle {
    color: #8bb8e8;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 18px;
    text-shadow: 1px 1px 0 #fff;
}

.instructions {
    text-align: left;
    background: #fff;
    border: 2px solid #ffe3ec;
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 22px;
    font-size: 0.95rem;
    color: #6a536e;
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.02);
}

.instructions h3 {
    font-size: 1rem;
    color: #ff7ebb;
    margin-bottom: 8px;
}

.instructions ul {
    list-style: none;
    margin-bottom: 10px;
}

.instructions li {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.key {
    background: #fdf2f7;
    border: 2px solid #ffc2db;
    border-radius: 8px;
    padding: 2px 8px;
    font-size: 0.8rem;
    margin-right: 10px;
    font-weight: bold;
    color: #ff5599;
}

.item {
    font-size: 1.2rem;
    margin-right: 10px;
}

.goal {
    color: #5599ff;
    text-align: center;
    font-weight: 800;
}

/* Result Box */
.result-box {
    margin: 20px 0 25px;
    background: #fff;
    border: 3px dashed #ffc5df;
    border-radius: 18px;
    padding: 15px;
}

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

.res-label {
    font-size: 0.85rem;
    color: #927599;
    font-weight: 800;
    margin-bottom: 3px;
}

.res-value {
    font-size: 2.2rem;
    font-weight: 900;
}

.reason {
    color: #9a76a5;
    font-weight: 800;
    margin-bottom: 10px;
}

/* Buttons */
.action-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 40px; /* Pillow rounded */
    font-size: 1.25rem;
    font-weight: 900;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #ff9ebb, #ff7ebb);
    border-bottom: 5px solid #d45992;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.bubble-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 126, 187, 0.4);
    filter: brightness(1.03);
}

.action-btn:active {
    transform: translateY(2px);
    border-bottom: 2px solid #d45992;
}

/* Sound Toggle & Back button */
#sound-toggle {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    z-index: 15;
    cursor: pointer;
    color: #a38ba9;
    border-color: #ffd1e3;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

#sound-toggle:hover {
    background: #ffeef4;
    border-color: var(--fairy-pink);
    transform: scale(1.05);
}

#back-to-portal {
    position: absolute;
    bottom: 15px;
    left: 15px;
    height: 46px;
    padding: 0 18px;
    border-radius: 23px;
    z-index: 15;
    color: #a38ba9;
    border-color: #ffd1e3;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 800;
    transition: all 0.2s ease;
}

#back-to-portal:hover {
    background: #ffeef4;
    border-color: var(--fairy-pink);
    transform: scale(1.05);
    color: var(--fairy-pink);
}

/* Cute D-Pad Controls */
#controls-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 10;
    display: none;
}

.dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 140px;
    height: 140px;
}

.dpad-middle-row {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
}

.dpad-center {
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
}

.ctrl-btn {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid #ffc2db;
    border-radius: 50%; /* Circle DPad buttons */
    color: var(--fairy-pink);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.1s ease;
    box-shadow: 0 4px 8px rgba(255, 126, 187, 0.2);
}

.ctrl-btn:active, .ctrl-btn.active {
    background: var(--fairy-pink);
    color: #fff;
    border-color: var(--fairy-pink);
    transform: scale(0.92);
    box-shadow: 0 0 10px rgba(255, 126, 187, 0.4);
}

#btn-up, #btn-down {
    margin: 2px 0;
}

/* Touch Device adjustments */
.touch-device #controls-container {
    display: block;
}

.touch-device #hud {
    top: 10px;
    height: 55px;
}

/* Landscape Mobile adjust */
@media (max-height: 500px) {
    #hud {
        top: 8px;
        height: 50px;
    }
    #controls-container {
        bottom: 10px;
        left: 10px;
    }
    .dpad {
        width: 120px;
        height: 120px;
    }
    .ctrl-btn {
        width: 38px;
        height: 38px;
    }
}
