/* MBLF GAME - Playful Kids Theme & Animation Styles */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@600;800;900&display=swap');

:root {
    --primary: #FF5E7E;
    --primary-dark: #E0355A;
    --green: #2ED573;
    --green-dark: #1EB85E;
    --blue: #1E90FF;
    --yellow: #FFA502;
    --purple: #9B59B6;
    --sky: #E8F7FF;
    --cloud: #FFFFFF;
    --text-dark: #2F3542;
    --card-bg: rgba(255, 255, 255, 0.95);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Nunito', -apple-system, sans-serif;
    background: linear-gradient(180deg, #70A6FF 0%, #BFE3FF 60%, #E8F7FF 100%);
    min-height: 100vh;
    color: var(--text-dark);
    overflow-x: hidden;
    position: relative;
}

/* Background floating clouds */
body::before {
    content: "☁️    ☁️         ☁️    ☁️";
    position: fixed;
    top: 50px;
    left: 0;
    width: 200%;
    font-size: 40px;
    opacity: 0.35;
    animation: driftClouds 35s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes driftClouds {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

#appRoot {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* TOP HEADER */
.game-header {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 4px solid #DFEEFB;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    font-size: 32px;
    animation: bounceLogo 2s ease-in-out infinite;
}

@keyframes bounceLogo {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.brand-text h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 22px;
    color: var(--primary);
    line-height: 1;
    text-shadow: 1px 1px 0 #FFB8C6;
}

.brand-text span {
    font-size: 11px;
    font-weight: 800;
    color: #747D8C;
}

.stats-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-badge {
    background: #FFFFFF;
    border: 2px solid #E4EBF5;
    padding: 5px 12px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 900;
    font-size: 15px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.04);
}

.stat-stars { color: #FFA502; }
.stat-coins { color: #E67E22; }

.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-ctrl {
    background: #FFFFFF;
    border: 2px solid #DCE6F2;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 3px 0 #CBD6E2;
    transition: transform 0.1s, box-shadow 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-ctrl:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #CBD6E2;
}

.btn-ctrl.active {
    background: #FFF3CD;
    border-color: #FFA502;
}

.user-badge {
    background: linear-gradient(135deg, #1E90FF, #00B894);
    color: #FFFFFF;
    border: none;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 3px 0 #008168;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* SCREEN 1: MAP SCREEN */
#mapScreen {
    padding: 16px;
    flex: 1;
}

.stage-banner {
    text-align: center;
    margin-bottom: 16px;
}

.stage-banner h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 26px;
    color: #FFFFFF;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.stage-tabs-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 16px;
    scrollbar-width: none;
}

.stage-tabs-scroll::-webkit-scrollbar { display: none; }

.stage-tab {
    flex: 0 0 auto;
    background: #FFFFFF;
    border: 3px solid #D9E4F0;
    border-radius: 18px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 4px 0 #C4D2E2;
    transition: all 0.2s;
}

.stage-tab.active {
    background: linear-gradient(135deg, #FFF5F7, #FFE8EE);
    border-color: var(--primary);
    box-shadow: 0 4px 0 var(--primary-dark);
    transform: translateY(-2px);
}

.stage-tab .st-icon { font-size: 24px; }
.stage-tab .st-name { font-weight: 900; font-size: 14px; color: var(--text-dark); display: block; text-align: left; }
.stage-tab .st-sub { font-size: 11px; font-weight: 700; color: #8395A7; display: block; text-align: left; }

.levels-container {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    border: 3px solid #FFFFFF;
    border-radius: 28px;
    padding: 20px 16px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
    gap: 15px;
    justify-items: center;
}

.level-node {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka One', cursive;
    font-size: 22px;
    position: relative;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.level-node.unlocked {
    background: linear-gradient(135deg, #2ED573, #10AC84);
    color: #FFFFFF;
    border: 4px solid #FFFFFF;
    box-shadow: 0 6px 0 #0E8062, 0 8px 15px rgba(46, 213, 115, 0.4);
}

.level-node.unlocked:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #0E8062;
}

.level-node.current-pulse {
    background: linear-gradient(135deg, #FF5E7E, #FF3838);
    box-shadow: 0 6px 0 #C21838, 0 0 20px rgba(255, 94, 126, 0.8);
    animation: pulseNode 1.5s infinite;
}

@keyframes pulseNode {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.level-node.locked {
    background: #CED6E0;
    color: #747D8C;
    border: 4px solid #DFE4EA;
    box-shadow: 0 5px 0 #A4B0BE;
    cursor: not-allowed;
    opacity: 0.85;
}

.lock-icon { font-size: 16px; margin-top: -2px; }
.lvl-stars {
    font-size: 10px;
    position: absolute;
    bottom: -6px;
    background: #FFFFFF;
    border: 1px solid #FFA502;
    border-radius: 10px;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* SCREEN 2: GAMEPLAY ARENA */
#arenaScreen {
    display: none;
    flex-direction: column;
    flex: 1;
    position: relative;
    overflow: hidden;
}

.arena-top-bar {
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 16px;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.btn-back-map {
    background: #FFA502;
    color: #FFFFFF;
    border: none;
    padding: 8px 14px;
    border-radius: 50px;
    font-weight: 900;
    font-size: 13px;
    box-shadow: 0 3px 0 #D38300;
    cursor: pointer;
}

.arena-title-box h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 18px;
    color: var(--primary);
    text-align: center;
}

.arena-title-box p {
    font-size: 12px;
    font-weight: 800;
    color: #747D8C;
    text-align: center;
}

.progress-container {
    width: 120px;
}

.progress-bar-bg {
    background: #E4EBF5;
    height: 12px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #CBD6E2;
}

.progress-bar-fill {
    background: linear-gradient(90deg, #2ED573, #00CEC9);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 11px;
    font-weight: 900;
    text-align: right;
    color: #576574;
    margin-top: 2px;
}

/* TARGET BANNER (GIANT KIDS BANNER) */
.target-banner {
    margin: 12px 16px 0 16px;
    background: #FFFFFF;
    border: 4px solid #FFA502;
    border-radius: 24px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 6px 0 #D38300, 0 10px 20px rgba(0,0,0,0.08);
    z-index: 10;
    animation: targetPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes targetPopIn {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.target-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.target-badge {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--primary);
    color: #FFFFFF;
    font-family: 'Fredoka One', cursive;
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}

.target-details .target-label {
    font-size: 12px;
    font-weight: 800;
    color: #8395A7;
    text-transform: uppercase;
}

.target-details .target-word {
    font-family: 'Fredoka One', cursive;
    font-size: 20px;
    color: var(--text-dark);
}

.btn-repeat-voice {
    background: #E8F7FF;
    border: 2px solid #1E90FF;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 3px 0 #0972DB;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}

.btn-repeat-voice:active { transform: translateY(2px); }

/* FLOATING BALLOON SKY */
#balloonSky {
    flex: 1;
    position: relative;
    overflow: hidden;
    margin-top: 10px;
}

.balloon {
    position: absolute;
    width: 78px;
    height: 94px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: inset -6px -6px 12px rgba(0,0,0,0.18), inset 6px 6px 12px rgba(255,255,255,0.4), 0 8px 16px rgba(0,0,0,0.15);
    z-index: 5;
    will-change: transform;
}

/* Balloon Highlight */
.balloon::before {
    content: "";
    position: absolute;
    top: 14px;
    left: 14px;
    width: 14px;
    height: 22px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    transform: rotate(-30deg);
}

/* Balloon Knot */
.balloon::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 8px;
    background: inherit;
    clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
}

.balloon-string {
    position: absolute;
    bottom: -32px;
    left: 50%;
    width: 2px;
    height: 30px;
    background: rgba(255, 255, 255, 0.85);
    transform: translateX(-50%);
}

.balloon-letter {
    font-family: 'Fredoka One', cursive;
    font-size: 34px;
    color: #FFFFFF;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    pointer-events: none;
}

.balloon.popped {
    animation: popDisappear 0.15s forwards;
}

@keyframes popDisappear {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
    100% { transform: scale(0); opacity: 0; }
}

.balloon.shake {
    animation: shakeError 0.4s ease-in-out;
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    70% { transform: translateX(10px); }
}

.pop-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    pointer-events: none;
    animation: particleFly 0.5s ease-out forwards;
    z-index: 6;
}

@keyframes particleFly {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0.2); opacity: 0; }
}

/* CHEEKU MASCOT (ANIMATED BUDDY) */
.mascot-container {
    position: absolute;
    bottom: 10px;
    left: 16px;
    z-index: 10;
    pointer-events: none;
}

.mascot {
    width: 90px;
    height: 90px;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mascot.idle {
    animation: cheekuBreathe 2.5s ease-in-out infinite;
}

@keyframes cheekuBreathe {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.mascot.celebrate {
    animation: cheekuJump 0.6s ease-in-out 2;
}

@keyframes cheekuJump {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-25px) scale(1.15) rotate(5deg); }
}

.mascot.confused {
    animation: cheekuScratch 0.4s ease-in-out;
}

@keyframes cheekuScratch {
    0%, 100% { transform: rotate(0); }
    50% { transform: rotate(-15deg); }
}

/* MODALS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 32, 67, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.modal-card {
    background: #FFFFFF;
    border: 4px solid #DFEEFB;
    border-radius: 32px;
    padding: 30px 24px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    animation: modalBounceIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

@keyframes modalBounceIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-avatar {
    font-size: 56px;
    margin-bottom: 10px;
}

.modal-card h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 26px;
    color: var(--primary);
    margin-bottom: 6px;
}

.modal-card p {
    font-size: 14px;
    font-weight: 700;
    color: #747D8C;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 900;
    color: #576574;
    margin-bottom: 6px;
}

.form-input, .form-select {
    width: 100%;
    padding: 12px 16px;
    background: #F1F5FA;
    border: 2px solid #DCE6F2;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 800;
    font-family: inherit;
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
    border-color: var(--blue);
    background: #FFFFFF;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #2ED573, #10AC84);
    color: #FFFFFF;
    border: none;
    padding: 14px;
    border-radius: 50px;
    font-family: 'Fredoka One', cursive;
    font-size: 18px;
    box-shadow: 0 6px 0 #0E8062, 0 8px 16px rgba(46, 213, 115, 0.4);
    cursor: pointer;
    transition: transform 0.1s;
    margin-top: 10px;
}

.btn-primary:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #0E8062;
}

/* VICTORY MODAL */
.victory-stars {
    font-size: 48px;
    margin: 10px 0;
    animation: starsSparkle 1.2s ease-in-out infinite;
}

@keyframes starsSparkle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.victory-rewards {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 16px 0;
}

.reward-pill {
    background: #FFF3CD;
    border: 2px solid #FFA502;
    padding: 8px 18px;
    border-radius: 50px;
    font-weight: 900;
    font-size: 16px;
    color: #D38300;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 14px;
    top: -20px;
    opacity: 0.9;
    animation: confettiFall 2.2s linear forwards;
    border-radius: 2px;
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(500px) rotate(720deg); opacity: 0; }
}

/* Responsive tweaks */
@media (max-width: 480px) {
    .brand-text h1 { font-size: 18px; }
    .level-node { width: 62px; height: 62px; font-size: 18px; }
    .balloon { width: 68px; height: 82px; }
    .balloon-letter { font-size: 28px; }
    .mascot { width: 70px; height: 70px; }
}
