/* General Base Styles */
:root {
    --font-primary: 'Quicksand', sans-serif;
    --font-heading: 'Fredoka One', cursive;
    --color-bg: #e0f7fa;
    --color-primary: #ff7675;
    --color-secondary: #74b9ff;
    --color-success: #55efc4;
    --color-warning: #ffeaa7;
    --color-text: #2d3436;
}

body {
    margin: 0;
    padding: 0;
    background-color: #a0e0e4;
    font-family: var(--font-primary);
    color: var(--color-text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    user-select: none;
}

#app-container {
    position: relative;
    width: 1024px;
    height: 576px;
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
    border: 10px solid #ffffff;
    border-radius: 36px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Confetti canvas */
#confetti-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

/* TOP BAR (HUD) */
#game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 25px;
    background-color: rgba(255, 255, 255, 0.85);
    border-bottom: 5px solid #b2ebf2;
    z-index: 100;
}

.nav-btn {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    padding: 8px 20px;
    border: 4px solid #636e72;
    border-radius: 20px;
    background-color: #ffffff;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    box-shadow: 0 5px 0 #636e72;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 0 #636e72;
}

.nav-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #636e72;
}

.text-speech-btn {
    background-color: var(--color-warning);
    border-color: #d63031;
    box-shadow: 0 5px 0 #d63031;
}

.text-speech-btn:hover {
    box-shadow: 0 7px 0 #d63031;
}

#star-hud {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: #ff9f43;
    text-shadow: 2px 2px 0 #d35400;
    background: #ffffff;
    padding: 6px 25px;
    border-radius: 25px;
    border: 4px solid #ff9f43;
}

/* SCREEN LAYOUTS */
.screen-overlay {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* SCREEN 1: WELCOME SCREEN */
#welcome-screen {
    background: linear-gradient(135deg, #74b9ff 0%, #a29bfe 100%);
    color: #ffffff;
}

.welcome-box {
    background-color: rgba(255, 255, 255, 0.95);
    color: var(--color-text);
    padding: 25px 35px;
    border-radius: 30px;
    width: 520px;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    border: 6px solid #ffeaa7;
    z-index: 10;
}

.welcome-badge {
    display: inline-block;
    background-color: #ff7675;
    color: #ffffff;
    font-family: var(--font-heading);
    padding: 5px 18px;
    border-radius: 15px;
    font-size: 1.2rem;
    transform: rotate(-3deg);
    margin-bottom: 12px;
    box-shadow: 0 4px 0 #d63031;
}

.welcome-title {
    font-family: var(--font-heading);
    font-size: 2.6rem;
    margin: 5px 0;
    color: #0984e3;
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.1);
}

.welcome-subtitle {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #636e72;
    font-weight: bold;
}

.input-group {
    margin-bottom: 20px;
}

.input-group input[type="text"] {
    width: 100%;
    padding: 12px 20px;
    border: 4px solid #b2ebf2;
    border-radius: 20px;
    font-size: 1.3rem;
    font-family: var(--font-heading);
    text-align: center;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
    color: #2d3436;
}

.input-group input[type="text"]:focus {
    border-color: #0984e3;
}

.avatar-select {
    margin-bottom: 25px;
}

.avatar-row {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.avatar-btn {
    width: 85px;
    height: 85px;
    border: 4px solid #dfe6e9;
    border-radius: 22px;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 0 #dfe6e9;
}

.avatar-emoji {
    font-size: 3.5rem;
    line-height: 1;
}

.avatar-btn:hover {
    background-color: #f1f2f6;
    transform: translateY(-3px);
}

.avatar-btn.selected {
    background-color: #ffeaa7;
    border-color: #fdcb6e;
    box-shadow: 0 6px 0 #fdcb6e;
    transform: scale(1.08);
}

.action-btn {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    padding: 12px 45px;
    border: 4px solid #d63031;
    border-radius: 25px;
    background-color: #ff7675;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 7px 0 #d63031;
    transition: transform 0.1s, box-shadow 0.1s;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 0 #d63031;
}

.action-btn:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #d63031;
}

/* Decorative balloons */
.decor-balloons {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.balloon {
    position: absolute;
    width: 70px;
    height: 90px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    animation: floatUp 8s infinite linear;
}

.balloon::after {
    content: "🎈";
    font-size: 3.5rem;
    position: absolute;
    top: 0;
    left: 0;
}

.balloon.red { left: 8%; animation-delay: 0s; }
.balloon.blue { left: 82%; animation-delay: 2.2s; }
.balloon.green { left: 45%; animation-delay: 4.5s; }

@keyframes floatUp {
    0% { transform: translateY(600px) rotate(0deg); opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.8; }
    100% { transform: translateY(-100px) rotate(15deg); opacity: 0; }
}

/* SCREEN 2: ROADMAP VIEW */
.map-path {
    position: relative;
    width: 90%;
    height: 280px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    box-sizing: border-box;
}

.map-line-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.map-node {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.map-node:hover {
    transform: scale(1.15);
}

.node-icon {
    width: 110px;
    height: 110px;
    background-color: #ffffff;
    border: 6px solid #ffeaa7;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
}

.node-status {
    position: absolute;
    top: -12px;
    right: -12px;
    background-color: #ffffff;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 4px solid #dfe6e9;
    font-size: 1.2rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.map-node.locked {
    pointer-events: none;
    opacity: 0.55;
}

.map-node.locked .node-icon {
    background-color: #dfe6e9;
    border-color: #b2bec3;
}

.map-node.completed .node-icon {
    border-color: var(--color-success);
    background-color: #e8f5e9;
}

.decor-trees {
    position: absolute;
    bottom: 12px;
    font-size: 2.2rem;
    letter-spacing: 120px;
    opacity: 0.25;
    pointer-events: none;
}

/* VOICE INSTRUCTION BAR & VISUAL PROMPTS */
.voice-instruction-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background-color: #ffffff;
    border: 4px solid var(--color-secondary);
    border-radius: 25px;
    padding: 12px 25px;
    margin-bottom: 30px;
    min-width: 300px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
}

.bubble-arrow {
    font-size: 2rem;
    animation: bounceSpeech 1s infinite alternate ease-in-out;
}

@keyframes bounceSpeech {
    0% { transform: scale(1); }
    100% { transform: scale(1.18); }
}

.voice-bubble {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: #0984e3;
    line-height: 1.4;
}

/* Visually representing target color block */
.color-target-display {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    border: 4px solid #2d3436;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Visually representing target counts */
.visual-target-row {
    display: flex;
    gap: 10px;
    font-size: 2.5rem;
}

.target-dot-off {
    opacity: 0.25;
    filter: grayscale(100%);
}

.target-dot-on {
    opacity: 1;
    filter: none;
    animation: popTarget 0.3s ease-out;
}

@keyframes popTarget {
    0% { transform: scale(0.6); }
    100% { transform: scale(1.2); }
}

/* STATION 1: BALLOONS */
.game-area-balloons {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    max-width: 800px;
    margin-top: 30px;
}

.pop-balloon-btn {
    position: relative;
    width: 140px;
    height: 180px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    border: none;
    cursor: pointer;
    box-shadow: inset -10px -10px 0 rgba(0,0,0,0.15), 0 10px 20px rgba(0,0,0,0.12);
    transition: transform 0.1s, opacity 0.2s;
    animation: sway 4s infinite ease-in-out;
}

/* Glossy highlight circle inside balloons */
.pop-balloon-btn::before {
    content: "";
    position: absolute;
    top: 25px;
    left: 30px;
    width: 25px;
    height: 25px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
}

.pop-balloon-btn::after {
    content: "";
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 20px;
    background-color: #7f8c8d;
}

.pop-balloon-btn:hover {
    transform: scale(1.08) translateY(-5px);
}

@keyframes sway {
    0%, 100% { transform: rotate(3deg) translateY(0); }
    50% { transform: rotate(-3deg) translateY(-10px); }
}

/* STATION 2: COUNTING */
.game-area-counting {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    max-width: 900px;
}

.apples-rack {
    width: 480px;
    min-height: 220px;
    background-color: rgba(255, 255, 255, 0.6);
    border: 5px dashed #74b9ff;
    border-radius: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 25px;
    box-sizing: border-box;
    justify-content: center;
    align-content: center;
}

.apple-item {
    font-size: 4rem;
    cursor: grab;
    user-select: none;
    transition: transform 0.15s;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 80px;
    height: 80px;
}

.apple-item:hover {
    transform: scale(1.12);
}

.apple-item:active {
    cursor: grabbing;
    transform: scale(1.25);
}

.basket-basket {
    position: relative;
    width: 220px;
    height: 170px;
    background: #d2b48c;
    border: 8px solid #8b5a2b;
    border-radius: 20px 20px 70px 70px;
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.15), inset 0 -12px 0 rgba(0,0,0,0.1);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    padding: 15px;
    box-sizing: border-box;
    gap: 5px;
    transition: background-color 0.2s;
}

.basket-basket.drag-hover {
    background-color: #ffeaa7;
}

.basket-counter-label {
    position: absolute;
    top: -28px;
    right: -28px;
    width: 60px;
    height: 60px;
    background-color: #ff7675;
    color: #ffffff;
    border: 5px solid #ffffff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-family: var(--font-heading);
    box-shadow: 0 5px 10px rgba(0,0,0,0.2);
}

.character-helper {
    font-size: 6rem;
    animation: HelperBounce 2s infinite ease-in-out;
}

/* STATION 3: SOUND FARM */
.game-area-farm {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 35px;
    width: 100%;
}

.big-sound-btn {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    padding: 18px 50px;
    border: 5px solid #fdcb6e;
    border-radius: 30px;
    background-color: #ffeaa7;
    color: #d35400;
    cursor: pointer;
    box-shadow: 0 8px 0 #fdcb6e, 0 12px 25px rgba(0,0,0,0.15);
    transition: transform 0.1s, box-shadow 0.1s;
}

.big-sound-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 11px 0 #fdcb6e;
}

.big-sound-btn:active {
    transform: translateY(4px);
    box-shadow: 0 4px 0 #fdcb6e;
}

.animal-cards-grid {
    display: flex;
    justify-content: center;
    gap: 30px;
    width: 90%;
    max-width: 850px;
}

.animal-card {
    flex: 1;
    background-color: #ffffff;
    border: 5px solid #dfe6e9;
    border-radius: 24px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.animal-card:hover {
    transform: translateY(-7px);
    border-color: var(--color-secondary);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.12);
}

.animal-emoji {
    font-size: 5rem;
    line-height: 1;
}

/* STATION 4: SHAPES */
.game-area-shapes {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    width: 100%;
}

.shapes-slots-row {
    display: flex;
    justify-content: center;
    gap: 50px;
    width: 100%;
}

.shape-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 150px;
}

.shape-shadow {
    width: 120px;
    height: 120px;
    background-color: rgba(0, 0, 0, 0.12);
    border: 5px dashed #b2bec3;
    transition: background-color 0.2s, transform 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.shape-shadow.circulo { border-radius: 50%; }
.shape-shadow.triangulo { clip-path: polygon(50% 0%, 0% 100%, 100% 100%); }
.shape-shadow.estrella { clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }

.shape-shadow.matched {
    background-color: var(--color-success);
    border-color: #55efc4;
    transform: scale(1.05);
}

.shapes-source-row {
    display: flex;
    justify-content: center;
    gap: 40px;
    background-color: rgba(255, 255, 255, 0.6);
    padding: 15px 50px;
    border-radius: 25px;
    border: 4px dashed #74b9ff;
}

.shape-item {
    font-size: 4.5rem;
    cursor: grab;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    transition: transform 0.1s;
}

.shape-item:hover {
    transform: scale(1.15);
}

/* STATION 5: ROBOT */
.game-area-robot {
    display: flex;
    justify-content: center;
    width: 100%;
}

.robot-canvas-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.55);
    padding: 25px 40px;
    border-radius: 30px;
    border: 5px solid #a29bfe;
}

.css-robot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
}

.interactive-part {
    cursor: pointer;
    transition: filter 0.15s, transform 0.15s, box-shadow 0.2s;
    position: relative;
}

.interactive-part:hover {
    filter: brightness(1.2);
    transform: scale(1.08);
}

.robot-head {
    width: 90px;
    height: 80px;
    background-color: #a29bfe;
    border: 5px solid #6c5ce7;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.robot-eyes {
    display: flex;
    gap: 15px;
}

.robot-eye {
    width: 18px;
    height: 18px;
    background-color: #ffeaa7;
    border: 3px solid #fdcb6e;
    border-radius: 50%;
}

.robot-mouth {
    width: 35px;
    height: 8px;
    background-color: #2d3436;
    border-radius: 4px;
}

.robot-body {
    width: 130px;
    height: 110px;
    background-color: #74b9ff;
    border: 5px solid #0984e3;
    border-radius: 20px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.robot-chest {
    font-size: 3.5rem;
}

.robot-arms-container {
    position: absolute;
    width: 210px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.robot-arm {
    width: 32px;
    height: 65px;
    background-color: #55efc4;
    border: 4px solid #00b894;
    border-radius: 12px;
    pointer-events: auto;
}

.arm-left { transform: rotate(15deg); }
.arm-right { transform: rotate(-15deg); }

.robot-hand {
    font-size: 1.5rem;
    text-align: center;
    margin-top: 35px;
}

.robot-legs-container {
    display: flex;
    gap: 30px;
}

.robot-leg {
    width: 32px;
    height: 60px;
    background-color: #ffeaa7;
    border: 4px solid #fdcb6e;
    border-radius: 12px;
}

.robot-foot {
    font-size: 1.5rem;
    text-align: center;
    margin-top: 30px;
}

/* Wiggle dance animation */
.robot-dance {
    animation: robotDance 0.4s infinite alternate ease-in-out;
}

@keyframes robotDance {
    0% { transform: rotate(-10deg) translateY(0); }
    100% { transform: rotate(10deg) translateY(-8px); }
}

/* SCREEN 8: VICTORY SCREEN */
#victory-screen {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
}

.victory-box {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 36px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    border: 8px solid #fdcb6e;
    z-index: 10;
    max-width: 520px;
}

.trophy-icon {
    font-size: 7rem;
    animation: pulse 1.5s infinite alternate ease-in-out;
    line-height: 1;
    margin-bottom: 20px;
}

@keyframes pulse {
    0% { transform: scale(0.9) rotate(-5deg); }
    100% { transform: scale(1.1) rotate(5deg); }
}

.stars-final-row {
    font-size: 4rem;
    color: #f1c40f;
    margin: 20px 0;
    letter-spacing: 12px;
}

/* Shaking animation for incorrect answers */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}
