/* =========================================
   GLOBAL
========================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;

    font-family: Arial, sans-serif;

    background: #F27A24;

    display: flex;
    justify-content: center;
    align-items: center;

    overflow: hidden;
}

#app {
    width: 95vw;
    height: 92vh;

    display: flex;
    justify-content: center;
    align-items: center;
}


/* =========================================
   SCREENS
========================================= */

.screen {
    width: 100%;
    height: 100%;

    max-width: 1000px;

    background: white;

    border-radius: 30px;

    display: none;

    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 35px;

    text-align: center;

    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.15);

    position: relative;

    overflow-y: auto;
}

.screen.active {
    display: flex;
}


/* =========================================
   TYPOGRAPHY
========================================= */

h1 {
    font-size: 2.3rem;
    color: #42FF18;

    margin-bottom: 10px;
}

h2 {
    font-size: 2rem;

    color: #F27A24;

    margin-bottom: 15px;
}

h3 {
    color: #F27A24;

    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;

    color: #666;

    line-height: 1.5;

    max-width: 650px;

    margin-bottom: 25px;
}


/* =========================================
   BUTTONS
========================================= */

.btn {
    background: #F27A24;

    color: white;

    border: none;

    border-radius: 50px;

    padding: 14px 40px;

    font-size: 1.1rem;

    font-weight: bold;

    cursor: pointer;

    margin: 6px;

    transition: all 0.2s ease;

    box-shadow:
        0 5px 15px rgba(242, 122, 36, 0.3);
}

.btn:hover {
    transform: translateY(-3px);
}

.btn-green {
    background: #42FF18;

    color: #111;

    box-shadow:
        0 5px 15px rgba(66, 255, 24, 0.3);
}


/* =========================================
   LOGO
========================================= */

#logo {
    width: 160px;

    margin-bottom: 15px;

    animation: float 3s ease-in-out infinite;
}


/* =========================================
   INTRO CHARACTERS
========================================= */

.intro-characters {
    width: 100%;

    max-width: 850px;

    display: flex;

    justify-content: center;

    align-items: flex-end;

    gap: 8px;

    margin: 10px 0 20px;
}

.intro-character {
    flex: 1;

    display: flex;

    flex-direction: column;

    align-items: center;
}

.intro-character img {
    width: 100%;

    height: 130px;

    object-fit: contain;

    transition: transform 0.2s ease;
}

.intro-character span {
    font-size: 0.75rem;

    font-weight: bold;

    color: #F27A24;
}

.intro-character:hover img {
    transform: translateY(-8px) scale(1.05);
}


/* =========================================
   GAME IMAGES
========================================= */

.game-image {
    max-height: 220px;

    width: auto;

    object-fit: contain;

    margin-bottom: 20px;
}


/* =========================================
   TREE
========================================= */

.points-display {
    background: #fff5ed;

    border-radius: 50px;

    padding: 10px 25px;

    color: #F27A24;

    font-weight: bold;

    margin-bottom: 10px;
}

.tree-stage {
    font-size: 9rem;

    height: 190px;

    display: flex;

    align-items: center;

    justify-content: center;

    animation: treeBounce 1.5s ease-in-out infinite;
}

.tree-message {
    color: #666;

    margin-bottom: 20px;

    font-size: 1rem;
}


/* =========================================
   WORD TRACKERS
========================================= */

.word-progress {
    margin-bottom: 15px;
}

.word-progress h3 {
    font-size: 0.9rem;

    margin-top: 5px;

    margin-bottom: 5px;
}

.word-tracker {
    display: flex;

    justify-content: center;

    gap: 5px;

    margin-bottom: 8px;
}

.word-letter {
    width: 32px;
    height: 32px;

    border-radius: 50%;

    background: #eee;

    color: #aaa;

    display: flex;

    align-items: center;
    justify-content: center;

    font-weight: bold;
}

.word-letter.completed {
    background: #42FF18;

    color: #111;
}


/* =========================================
   CHARACTER INTRO
========================================= */

.activity-character {
    height: 200px;

    width: auto;

    object-fit: contain;

    margin-bottom: 10px;

    animation: characterBounce 0.8s ease-in-out infinite alternate;
}


/* =========================================
   ACTIVITY SCREEN
========================================= */

.activity-header {
    width: 100%;

    display: flex;

    justify-content: space-between;

    color: #888;

    font-size: 0.9rem;

    margin-bottom: 15px;
}

.activity-area {
    width: min(90%, 650px);

    min-height: 220px;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    margin-bottom: 20px;
}


/* =========================================
   ACTIVITY BUTTONS
========================================= */

.activity-choice {
    width: min(90%, 500px);

    background: white;

    border: 3px solid #F27A24;

    border-radius: 20px;

    padding: 15px;

    margin: 6px;

    font-size: 1rem;

    font-weight: bold;

    cursor: pointer;

    transition: all 0.2s ease;
}

.activity-choice:hover {
    background: #fff3e9;

    transform: translateY(-2px);
}

.activity-choice.correct {
    background: #42FF18;

    border-color: #42FF18;
}

.activity-choice.incorrect {
    opacity: 0.5;
}


/* =========================================
   TAP GAME
========================================= */

.tap-peach {
    font-size: 4rem;

    border: none;

    background: none;

    padding: 20px;

    cursor: pointer;

    transition: transform 0.1s ease;

    position: relative;
}

.tap-peach:active {
    transform: scale(0.8);
}

.tap-counter {
    color: #F27A24;

    font-size: 1.2rem;

    font-weight: bold;

    margin-top: 10px;
}


/* =========================================
   BREATHING GAME
========================================= */

.breathing-wrapper {
    width: 100%;

    height: 190px;

    display: flex;

    align-items: center;
    justify-content: center;

    margin-bottom: 15px;
}

.breathing-circle {
    width: 110px;

    height: 110px;

    border-radius: 50%;

    background: #42FF18;

    display: flex;

    align-items: center;
    justify-content: center;

    color: #111;

    font-weight: bold;

    animation: breathe 7s ease-in-out infinite;
}


/* =========================================
   REWARD
========================================= */

.reward-star {
    font-size: 5rem;

    animation: starPop 0.6s ease;
}

.earned-letter {
    display: flex;

    flex-direction: column;

    align-items: center;

    margin: 15px;
}

.earned-letter span {
    color: #777;
}

.earned-letter strong {
    font-size: 4rem;

    color: #F27A24;
}

.reward-tree {
    font-size: 7rem;

    margin: 10px;

    animation: treeBounce 1s ease-in-out infinite;
}


/* =========================================
   FINAL CELEBRATION
========================================= */

.final-tree {
    font-size: 10rem;

    animation: treeBounce 1.5s ease-in-out infinite;
}

.completed-words {
    display: flex;

    gap: 20px;

    margin: 15px 0;
}

.completed-words div {
    display: flex;

    flex-direction: column;

    background: #fff5ed;

    padding: 15px 25px;

    border-radius: 20px;
}

.completed-words strong {
    color: #F27A24;

    font-size: 1.3rem;
}

.completed-words span {
    color: #42a51e;

    font-size: 0.8rem;

    margin-top: 5px;
}

.celebration-message {
    max-width: 550px;

    color: #555;

    line-height: 1.5;

    margin-bottom: 15px;
}


/* =========================================
   CHARACTER GALLERY
========================================= */

.character-intro {
    color: #666;

    margin-bottom: 20px;
}

.character-gallery {
    width: 100%;

    max-width: 850px;

    display: grid;

    grid-template-columns:
        repeat(7, 1fr);

    gap: 8px;

    margin-bottom: 20px;
}

.character-item {
    background: white;

    border: 3px solid transparent;

    border-radius: 20px;

    padding: 8px;

    cursor: pointer;

    transition: all 0.2s ease;
}

.character-item:hover {
    border-color: #42FF18;

    transform: translateY(-5px);
}

.character-item img {
    width: 100%;

    height: 130px;

    object-fit: contain;
}

.character-item h3 {
    font-size: 0.9rem;

    margin: 5px 0 0;
}


/* =========================================
   CHARACTER CARD
========================================= */

.character-card {
    position: absolute;

    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);

    width: min(90%, 600px);

    max-height: 85%;

    overflow-y: auto;

    background: white;

    border-radius: 30px;

    padding: 30px;

    box-shadow:
        0 15px 50px rgba(0, 0, 0, 0.3);

    z-index: 100;
}

.character-card.hidden {
    display: none;
}

#character-card-image {
    height: 180px;

    width: auto;

    object-fit: contain;
}

#character-card-name {
    color: #F27A24;

    font-size: 1.8rem;
}

.character-time {
    color: #666;
}

.character-role {
    color: #42a51e;

    font-weight: bold;
}

#character-card-description {
    line-height: 1.6;

    color: #333;
}

.close-card-btn {
    position: absolute;

    top: 12px;
    right: 15px;

    width: 40px;
    height: 40px;

    border: none;

    border-radius: 50%;

    background: #F27A24;

    color: white;

    font-size: 1.5rem;

    cursor: pointer;
}


/* =========================================
   ANIMATIONS
========================================= */

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes treeBounce {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes characterBounce {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-8px);
    }
}

@keyframes starPop {
    0% {
        transform: scale(0);
    }

    80% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes breathe {
    0%, 100% {
        transform: scale(0.8);
    }

    50% {
        transform: scale(1.4);
    }
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 700px) {

    body {
        overflow: auto;
    }

    #app {
        width: 100%;
        height: 100vh;
    }

    .screen {
        min-height: 100vh;

        border-radius: 0;

        padding: 25px 15px;
    }

    .intro-characters {
        flex-wrap: wrap;
    }

    .intro-character {
        flex: 0 0 13%;
    }

    .intro-character img {
        height: 90px;
    }

    .tree-stage {
        font-size: 7rem;
    }

    .character-gallery {
        grid-template-columns: repeat(3, 1fr);

        max-height: 50vh;

        overflow-y: auto;
    }

    .completed-words {
        flex-direction: column;

        gap: 8px;
    }
}

/* Growth Transition Animation */
.tree-stage.grow-pop,
.reward-tree.grow-pop {
    animation: growPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes growPop {
    0% {
        transform: scale(0.3);
        opacity: 0.3;
    }
    70% {
        transform: scale(1.25);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}


/* Dynamic Bouncing Peach */
.activity-area {
    width: min(90%, 650px);
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
}

.tap-peach.bouncing {
    position: absolute;
    margin: 0;
}

/* Catch Game */
.catch-game-area {
    width: 100%;
    max-width: 400px;
    height: 200px;
    background: #6cbae4;
    border: 4px solid #F27A24;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    touch-action: none;
}

.catch-basket {
    position: absolute;
    bottom: 5px;
    left: 50%;
    font-size: 2.5rem;
    user-select: none;
}

.falling-item {
    position: absolute;
    top: 0;
    font-size: 1.8rem;
}

/* Slider Game */
.slider-game-container {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.slider-track {
    width: 100%;
    height: 20px;
    background: #eee;
    border-radius: 10px;
    position: relative;
}

.target-zone {
    position: absolute;
    left: 40%;
    width: 20%;
    height: 100%;
    background: #42FF18;
    border-radius: 10px;
}

.balance-slider {
    width: 100%;
    cursor: pointer;
}


/* Larger Catch Game */
.catch-game-area.large {
    width: 100%;
    max-width: 550px; /* Expanded size */
    height: 280px;    /* Expanded height */
    background: #a1cff0;
    border: 4px solid #F27A24;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    touch-action: none;
}

.catch-basket {
    position: absolute;
    bottom: 8px;
    left: 45%;
    font-size: 3.5rem; /* Larger icon */
    user-select: none;
}

.falling-item {
    position: absolute;
    top: 0;
    font-size: 2.2rem;
}

/* Grow Game */
.grow-game-container {
    position: relative;
    width: 220px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.grow-target-ring {
    position: absolute;
    width: 200px;
    height: 200px;
    border: 4px dashed #42FF18;
    border-radius: 50%;
}

.grow-bubble {
    font-size: 4rem;
    transition: transform 0.1s linear;
    user-select: none;
}

.hold-btn {
    user-select: none;
    -webkit-user-select: none;
}

/* Grow Game Side-by-Side Row */
.grow-game-container-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
}

.grow-flower-box {
    position: relative;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grow-target-ring-sm {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 3px dashed #42FF18;
    border-radius: 50%;
}

.grow-flower-icon {
    font-size: 3rem;
    transform: scale(0.2);
    opacity: 0.3;
    transition: transform 0.1s linear, opacity 0.1s linear;
    user-select: none;
}

.grow-flower-icon.bloomed {
    animation: flowerPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes flowerPop {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.25); }
    100% { transform: scale(1); }
}


/* Grow Game Direct Interaction */
.grow-flower-box {
    position: relative;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.grow-flower-box.active-target .grow-target-ring-sm {
    border-color: #42FF18;
    animation: ringPulse 1.2s infinite ease-in-out;
}

.grow-target-ring-sm {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 3px dashed #ccc;
    border-radius: 50%;
    transition: border-color 0.3s ease;
}

.grow-flower-icon {
    font-size: 3rem;
    transform: scale(0.2);
    opacity: 0.3;
    pointer-events: none; /* Passes touch/click events directly to the box container */
    transition: transform 0.1s linear, opacity 0.1s linear;
}

@keyframes ringPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(66, 255, 24, 0.4);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 0 12px 4px rgba(66, 255, 24, 0.3);
    }
}