:root {
    --sky: #c7eeff;
    --sun: #ffe380;
    --leaf: #c8f7b6;
    --pink: #ffd0e5;
    --purple: #b9b6ff;
    --ink: #213547;
    --white: #ffffff;
    --card-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Comic Neue', cursive;
    color: var(--ink);
    background: linear-gradient(180deg, var(--sky) 0%, var(--sun) 40%, var(--pink) 100%);
    display: grid;
    place-items: center;
    padding: 16px;
}

.app {
    width: min(960px, 100%);
    background: rgba(255, 255, 255, 0.35);
    border-radius: var(--radius-xl);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(3px);
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.5);
    position: relative;
}

.screen {
    padding: clamp(16px, 3vw, 28px);
    min-height: min(90vh, 700px);
    display: none;
    animation: fadeIn 0.4s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.float {
    animation: float 2.6s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-7px);
    }
}

.pulse {
    animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.04);
    }
}

.bounce {
    animation: bounce 0.7s ease;
}

@keyframes bounce {
    0% {
        transform: scale(0.8);
    }

    50% {
        transform: scale(1.08);
    }

    100% {
        transform: scale(1);
    }
}

.form-card {
    margin: 0 auto;
    width: min(640px, 100%);
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--card-shadow);
    padding: clamp(18px, 4vw, 30px);
    text-align: center;
}

.title {
    margin: 6px 0;
    font-size: clamp(1.8rem, 5vw, 2rem);
    color: #14516f;
    line-height: 1.15;
}

.icon {
    font-size: clamp(2.2rem, 10vw, 4rem);
    margin-bottom: 8px;

}

.icon img {
    width: 150px;
    height: auto;

}

.sub {
    margin: 0 0 14px;
    font-size: clamp(1rem, 2.4vw, 1.25rem);
    color: #52758d;
}

.field {
    text-align: left;
    margin-bottom: 14px;
}

.field label {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: #35607a;
}

.field input {
    width: 100%;
    border: 3px solid #d0ecff;
    border-radius: var(--radius-md);
    font-size: 1.2rem;
    padding: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus {
    border-color: #7cc4ff;
    box-shadow: 0 0 0 4px rgba(124, 196, 255, 0.28);
}

.main-btn {
    width: 50%;
    border: none;
    border-radius: 999px;
    font-size: clamp(1.2rem, 3.5vw, 1.6rem);
    font-weight: 800;
    background: linear-gradient(140deg, #65d6ff, #ffd766);
    color: #11435c;
    padding: 15px 18px;
    box-shadow: 0 8px 0 #6cb4dd;
    cursor: pointer;
    transition: transform 0.12s;
}

.main-btn:active {
    transform: translateY(3px);
    box-shadow: 0 5px 0 #6cb4dd;
}

.error-msg {
    min-height: 28px;
    margin-top: 10px;
    color: #d7265e;
    font-size: 1.05rem;
    font-weight: 700;
}

.top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.stage-title {
    font-size: clamp(1.5rem, 4vw, 2.3rem);
    margin: 0;
    color: #0f5f8d;
}

/* عند الاختفاء */
.stage-title.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

/* عند الظهور */
.stage-title.fade-in {
    opacity: 1;
    transform: translateY(0);
}



.game-area {
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 14px;
    margin-top: 8px;
}

.drop-zone {
    background: rgba(255, 255, 255, 0.8);
    border: 4px dashed #5ac3ef;
    border-radius: var(--radius-lg);
    min-height: clamp(150px, 24vh, 210px);
    display: grid;
    place-items: center;
    font-size: clamp(1.3rem, 4vw, 2rem);
    color: #2f7a9f;
    transition: all 0.2s ease;
    text-align: center;
    padding: 12px;
}

.drop-zone.active {
    background: #ecfaff;
    transform: scale(1.01);
}

.options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.option {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 3px solid #d8f2ff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    min-height: clamp(108px, 22vw, 150px);
    display: grid;
    place-items: center;
    cursor: grab;
    user-select: none;
    padding: 10px;
    text-align: center;
    font-size: clamp(2rem, 7vw, 3rem);
}

.option:active {
    cursor: grabbing;
}

.option small {
    display: block;
    font-size: clamp(1rem, 2.6vw, 1.1rem);
    color: #44657d;
    font-weight: 700;
    margin-top: 4px;
}

.feedback {
    min-height: 38px;
    font-size: clamp(1.1rem, 3.3vw, 1.4rem);
    font-weight: 800;
    text-align: center;
    color: #1e7f4f;
}

.feedback.wrong {
    color: #c82458;
}

.stars {
    font-size: clamp(1.4rem, 4vw, 2rem);
    line-height: 1;
    margin-top: 4px;
    letter-spacing: 4px;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(34, 67, 88, 0.68);
    display: none;
    place-items: center;
    z-index: 99;
    padding: 12px;
}

.overlay.show {
    display: grid;
}

.popup {
    width: min(620px, 96vw);
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    text-align: center;
    padding: clamp(20px, 5vw, 36px);
    border: 4px solid #d3f4ff;
    position: relative;
    overflow: hidden;
}

.popup h2 {
    margin: 2px 0 8px;
    font-size: clamp(2rem, 7vw, 3rem);
    color: #106087;
}

.popup p {
    margin: 0 0 14px;
    font-size: clamp(1.15rem, 3.5vw, 1.5rem);
    color: #30576f;
}

.confetti {
    font-size: clamp(1.1rem, 3vw, 1.6rem);
    margin-bottom: 10px;
    animation: float 2.1s ease-in-out infinite;
    letter-spacing: 4px;
}

.name-chip {
    display: inline-block;
    background: #f1fbff;
    border-radius: 999px;
    padding: 8px 15px;
    font-size: 1.08rem;
    margin-bottom: 10px;
    color: #1d7098;
    border: 2px solid #cdefff;
}

.option.dragging {
    opacity: 0.6;
    transform: scale(1.05);
}

/* انتقال ناعم */
.stage-transition {
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.4s ease;
}

.stage-transition.show {
    opacity: 1;
    transform: scale(1);
}

/* حركة النجاح */
.correct-anim {
    animation: pop 0.4s ease;
}

@keyframes pop {
    0% {
        transform: scale(0.8);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.option-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 6px;
}

@media (max-width: 760px) {
    .screen {
        min-height: auto;
    }

    .top-row {
        justify-content: center;
    }

    .stage-title {
        width: 100%;
        text-align: center;
    }

    .options {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .option {

        min-height: auto;
    }

    .option-img {
        width: 100%;
        height: auto;
    }

    .option small {
        font-size: 12px;
    }
}

/* =========================
   🔊 Audio Controls
========================= */

.audio-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
}

.listen-btn {
    border: none;
    outline: none;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    min-width: 180px;
    height: 58px;

    padding: 12px 20px;
    border-radius: 999px;

    font-family: 'Comic Neue', cursive;
    font-size: 20px;
    font-weight: 700;
    color: #fff;

    background: linear-gradient(135deg,
            #22c55e,
            #16a34a);

    box-shadow:
        0 10px 25px rgba(34, 197, 94, .35);

    transition: all .25s ease;
}

.listen-btn:hover {
    transform: translateY(-3px) scale(1.05);
}

.listen-btn:active {
    transform: scale(.96);
}

.listen-btn.pulse {
    animation: pulseGreen 2s infinite;
}


@keyframes pulseGreen {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, .5);
    }

    70% {
        box-shadow: 0 0 0 18px rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.stage-title {
    text-align: center;
    font-size: 1.6rem;
    line-height: 1.5;
    max-width: 700px;
    margin: 0 auto 15px;
    color: #2c3e50;
}

.story-card {
    max-width: 700px;
    margin: 0 auto;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--card-shadow);
    padding: 35px 25px;
    text-align: center;
}

.story-icon {
    font-size: 4rem;
    margin-bottom: 10px;
}

.story-title {
    color: #0f5f8d;
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    margin-bottom: 25px;
}

.story-text {
    background: #f4fcff;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    border: 3px dashed #9edfff;
}

.story-text p {
    margin: 12px 0;
    font-size: clamp(1.3rem, 3vw, 1.7rem);
    font-weight: 700;
    color: #30576f;
    line-height: 1.6;
}

.story-play-btn {
    border: none;
    border-radius: 999px;
    padding: 14px 30px;
    margin-bottom: 20px;

    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Comic Neue', cursive;

    color: white;

    background: linear-gradient(135deg,
            #22c55e,
            #16a34a);

    box-shadow: 0 8px 20px rgba(34, 197, 94, .35);

    cursor: pointer;

    transition: .25s;
}

.story-play-btn:hover {
    transform: translateY(-2px);
}

.button-instagram-follow {
    width: 100%;
    height: 2.5em;
    background-color: #fff;
    border: 1px solid #bc2a8d;
    padding: 5px;
    margin: 10px auto;
    transition: 0.5s;
    font-size: 17px;
    border-radius: 999px;

    /* التعديل الأساسي للتوسيط */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    /* المسافة بين النص والأيقونة */
    cursor: pointer;
}

.button-instagram-follow p {
    margin: 0;
    padding: 0;
    transition: .5s;
    color: #bc2a8d;
    font-weight: 500;
    /* لجعل النص أوضح قليلاً */
}

.button-instagram-follow svg {
    margin: 0;
    padding: 0;
    transition: 0.5s;
    height: 1.1em;
    width: 1.1em;
    fill: #bc2a8d;
    /* تم تغيير اللون للوردي ليظهر فوق الخلفية البيضاء */
}

/* تأثير الـ Hover عند تمرير الماوس */
.button-instagram-follow:hover {
    background-color: #bc2a8d;
}

.button-instagram-follow:hover p {
    color: #fff;
}

.button-instagram-follow:hover svg {
    fill: #fff;
    /* يتحول لون الأيقونة للأبيض ليناسب الخلفية الوردية */
}

.invalid {
    border: 2px solid #e53935 !important;
}