/* =========================================================
   EnglishWords — صفحة اختيار المستوى والتصنيف
========================================================= */

* {
    box-sizing: border-box;
}


html {
    scroll-behavior: smooth;
}


body {
    margin: 0;
    min-height: 100vh;

    background: #f8f9fc;

    color: #171827;

    font-family:
        Arial,
        Tahoma,
        sans-serif;
}


button {
    font-family: inherit;

    -webkit-tap-highlight-color: transparent;
}


/* =========================================================
   الشريط العلوي
========================================================= */

.topbar {

    width: 100%;
    max-width: 900px;

    min-height: 70px;

    margin: 0 auto;

    padding: 12px 20px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 12px;

    background: rgba(255,255,255,.97);

    border-bottom:
        1px solid #eeeeF5;

    position: relative;

    z-index: 10;
}


.back-btn {

    border:
        1px solid #e4e4ee;

    background: white;

    color: #5c50df;

    padding:
        10px 16px;

    border-radius: 15px;

    font-size: 14px;

    font-weight: bold;

    cursor: pointer;

    box-shadow:
        0 3px 12px
        rgba(40,35,100,.05);

    transition: .18s ease;
}


.back-btn:hover {

    transform:
        translateY(-1px);
}


.back-btn:active {

    transform:
        scale(.97);
}


.page-title {

    flex: 1;

    text-align: center;

    font-size: 22px;

    font-weight: 800;
}


.title-icon {

    background: transparent !important;

    border: none !important;

    padding: 0 !important;

    margin: 0 !important;
}


/* =========================================================
   الحاوية
========================================================= */

.container {

    width: 100%;

    max-width: 850px;

    margin: 0 auto;

    padding:
        22px 22px 90px;
}


/* =========================================================
   البانر
========================================================= */

.intro {

    position: relative;

    overflow: hidden;

    min-height: 175px;

    padding:
        25px 28px;

    margin-bottom: 22px;

    display: flex;

    align-items: center;

    border-radius: 25px;

    color: white;

    background:
        radial-gradient(
            circle at 92% 15%,
            rgba(255,255,255,.13)
            0 75px,
            transparent 76px
        ),

        linear-gradient(
            125deg,
            #5d4ee8,
            #7661f2 55%,
            #684fe5
        );

    box-shadow:
        0 12px 30px
        rgba(96,78,226,.20);
}


.intro::after {

    content: "📚";

    position: absolute;

    left: 28px;

    bottom: 8px;

    font-size: 72px;

    line-height: 1;

    transform:
        rotate(-7deg);

    filter:
        drop-shadow(
            0 8px 7px
            rgba(0,0,0,.15)
        );
}


.intro-content {

    position: relative;

    z-index: 2;

    max-width: 560px;
}


.intro-label {

    display: inline-block;

    padding:
        7px 13px;

    margin-bottom: 8px;

    border-radius: 18px;

    background:
        rgba(255,255,255,.14);

    border:
        1px solid
        rgba(255,255,255,.12);

    font-size: 13px;

    font-weight: bold;
}


.intro h1 {

    margin:
        0 0 7px;

    font-size: 30px;

    line-height: 1.25;
}


.intro h1 span {

    display: inline;

    padding: 0;

    margin: 0;

    background: transparent;

    border: none;

    font-size: inherit;
}


.intro p {

    margin: 0;

    max-width: 470px;

    color:
        rgba(255,255,255,.92);

    font-size: 13px;

    line-height: 1.7;
}


.intro-decoration {

    position: absolute;

    inset: 0;

    pointer-events: none;
}


.floating-book {

    position: absolute;

    left: 45px;

    bottom: 15px;

    font-size: 65px;

    transform:
        rotate(-7deg);
}


.floating-star {

    position: absolute;

    color: rgba(255,255,255,.7);

    font-size: 25px;
}


.star-one {

    top: 25px;

    left: 35%;
}


.star-two {

    bottom: 35px;

    right: 15%;
}


/* =========================================================
   عناوين الأقسام
========================================================= */

.section-heading {

    margin:
        19px 3px 10px;
}


.heading-content {

    display: flex;

    align-items: center;

    gap: 10px;
}


.section-number {

    display: flex;

    align-items: center;

    justify-content: center;

    width: 38px;

    height: 38px;

    flex-shrink: 0;

    border-radius: 12px;

    background: #eeeaff;

    color: #6755e8;

    font-size: 12px;

    font-weight: 800;
}


.section-heading h2 {

    margin: 0;

    font-size: 19px;

    font-weight: 800;
}


.section-heading p {

    margin:
        3px 0 0;

    color: #858596;

    font-size: 11px;
}


/* =========================================================
   المستويات
========================================================= */

.levels {

    display: grid;

    gap: 9px;
}


.level-card {

    width: 100%;

    min-height: 78px;

    display: flex;

    align-items: center;

    gap: 15px;

    padding:
        9px 12px;

    border:
        1px solid #e9e9f1;

    border-radius: 17px;

    background: white;

    text-align: right;

    cursor: pointer;

    box-shadow:
        0 3px 12px
        rgba(25,25,60,.045);

    transition:
        transform .18s ease,
        box-shadow .18s ease,
        border-color .18s ease,
        background .18s ease;
}


.level-card:hover {

    transform:
        translateY(-2px);

    box-shadow:
        0 7px 18px
        rgba(50,45,100,.08);
}


.level-card:active {

    transform:
        scale(.985);
}


.level-badge {

    width: 70px;

    min-width: 70px;

    height: 55px;

    display: flex;

    align-items: center;

    justify-content: center;

    border-radius: 14px;

    color: white;

    background:
        linear-gradient(
            145deg,
            #6b58ef,
            #5846db
        );

    font-size: 22px;

    font-weight: 800;

    box-shadow:
        0 5px 12px
        rgba(94,76,225,.16);
}


.level-card:nth-child(2)
.level-badge {

    background:
        linear-gradient(
            145deg,
            #4e8ced,
            #356ed1
        );
}


.level-card:nth-child(3)
.level-badge {

    background:
        linear-gradient(
            145deg,
            #3cc485,
            #22a968
        );
}


.level-content {

    flex: 1;
}


.level-card h3 {

    margin:
        0 0 3px;

    font-size: 16px;
}


.level-card p {

    margin: 0;

    color: #7d7e8e;

    font-size: 11px;

    line-height: 1.4;
}


.select-circle {

    width: 27px;

    height: 27px;

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

    border:
        2px solid #e1e1eb;

    border-radius: 50%;

    color: transparent;

    font-size: 13px;

    font-weight: bold;
}


.level-card.selected {

    border-color:
        #6a58eb;

    background:
        #faf9ff;

    box-shadow:
        0 6px 18px
        rgba(98,80,230,.11);
}


.level-card.selected
.select-circle {

    border-color:
        #6a58eb;

    background:
        #6a58eb;

    color: white;
}


/* =========================================================
   التصنيفات
========================================================= */

.categories {

    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 9px;
}


.category-card {

    position: relative;

    min-height: 112px;

    padding:
        10px 6px;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    border:
        1px solid #e9e9f1;

    border-radius: 17px;

    background: white;

    cursor: pointer;

    box-shadow:
        0 3px 12px
        rgba(25,25,60,.045);

    transition:
        transform .18s ease,
        box-shadow .18s ease,
        border-color .18s ease,
        background .18s ease;
}


.category-card:hover {

    transform:
        translateY(-2px);

    box-shadow:
        0 8px 18px
        rgba(40,35,90,.08);
}


.category-card:active {

    transform:
        scale(.97);
}


.category-icon {

    width: 47px;

    height: 47px;

    display: flex;

    align-items: center;

    justify-content: center;

    margin-bottom: 6px;

    border-radius: 14px;

    background: #e8f9f1;

    font-size: 27px;
}


.category-card:nth-child(2)
.category-icon {

    background: #fff1d8;
}


.category-card:nth-child(3)
.category-icon {

    background: #e4f0ff;
}


.category-card:nth-child(4)
.category-icon {

    background: #ffe5ea;
}


.category-card:nth-child(5)
.category-icon {

    background: #eee8ff;
}


.category-card:nth-child(6)
.category-icon {

    background: #e4f7d9;
}


.category-card:nth-child(7)
.category-icon {

    background: #fff0dd;
}


.category-card:nth-child(8)
.category-icon {

    background: #e9e5ff;
}


.category-info {

    text-align: center;
}


.category-card strong {

    display: block;

    margin-bottom: 2px;

    color: #202031;

    font-size: 14px;
}


.category-card small {

    color: #858596;

    font-size: 10px;
}


.category-check {

    position: absolute;

    top: 6px;

    right: 6px;

    width: 22px;

    height: 22px;

    display: flex;

    align-items: center;

    justify-content: center;

    border-radius: 50%;

    background: transparent;

    color: transparent;

    font-size: 11px;

    font-weight: bold;
}


.category-card.selected {

    border:
        2px solid #6655e9;

    background:
        #faf9ff;

    box-shadow:
        0 7px 18px
        rgba(99,82,229,.12);
}


.category-card.selected
.category-check {

    background:
        #6755e8;

    color: white;
}


/* =========================================================
   تحميل التصنيفات
========================================================= */

.loading-categories {

    grid-column:
        1 / -1;

    min-height: 130px;

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 10px;

    border:
        1px solid #e9e9f1;

    border-radius: 17px;

    background: white;

    color: #77788a;

    font-size: 13px;
}


.loading-categories span {

    font-size: 22px;
}


/* =========================================================
   خطأ التصنيفات
========================================================= */

.categories-error {

    grid-column:
        1 / -1;

    min-height: 140px;

    padding: 20px;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    border:
        1px solid #ececf3;

    border-radius: 17px;

    background: white;

    text-align: center;
}


.categories-error > div {

    font-size: 28px;

    margin-bottom: 6px;
}


.categories-error p {

    margin:
        0 0 10px;

    color: #77788a;

    font-size: 12px;
}


.categories-error button {

    border: none;

    border-radius: 10px;

    padding:
        8px 14px;

    background: #6755e8;

    color: white;

    cursor: pointer;
}


/* =========================================================
   رسالة الاختيار
========================================================= */

.selection-message {

    margin-top: 16px;

    padding:
        10px 14px;

    border-radius: 12px;

    background: #f0efff;

    color: #7167a8;

    text-align: center;

    font-size: 11px;

    transition: .2s ease;
}


.selection-message.ready {

    background: #eaf9f2;

    color: #25805a;
}


/* =========================================================
   زر ابدأ التعلم
========================================================= */

.start-area {

    width: 100%;
}


.start-btn {

    width: 100%;

    min-height: 54px;

    margin-top: 10px;

    border: none;

    border-radius: 17px;

    color: white;

    background:
        linear-gradient(
            135deg,
            #6d59f0,
            #5a48df
        );

    font-size: 17px;

    font-weight: 800;

    cursor: pointer;

    box-shadow:
        0 8px 20px
        rgba(92,73,225,.20);

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 12px;

    transition:
        transform .18s ease,
        box-shadow .18s ease,
        opacity .18s ease;
}


.start-arrow {

    font-size: 20px;
}


.start-btn:not(:disabled):hover {

    transform:
        translateY(-2px);

    box-shadow:
        0 11px 24px
        rgba(92,73,225,.25);
}


.start-btn:not(:disabled):active {

    transform:
        scale(.98);
}


.start-btn:disabled {

    opacity: .45;

    cursor: not-allowed;

    box-shadow: none;
}


/* =========================================================
   الجوال
========================================================= */

@media (max-width: 650px) {

    body {

        overflow-x: hidden;
    }


    .topbar {

        min-height: 60px;

        padding:
            8px 12px;

        gap: 8px;
    }


    .page-title {

        font-size: 18px;
    }


    .back-btn {

        padding:
            8px 11px;

        border-radius: 13px;

        font-size: 12px;
    }


    .container {

        padding:
            12px 12px 75px;
    }


    .intro {

        min-height: 125px;

        padding:
            16px 18px;

        margin-bottom: 12px;

        border-radius: 20px;
    }


    .intro-label {

        padding:
            5px 10px;

        margin-bottom: 5px;

        font-size: 10px;
    }


    .intro h1 {

        margin-bottom: 4px;

        font-size: 23px;
    }


    .intro p {

        max-width: 240px;

        font-size: 10px;

        line-height: 1.55;
    }


    .intro::after {

        left: 4px;

        bottom: 5px;

        font-size: 50px;
    }


    .floating-book {

        left: 4px;

        bottom: 5px;

        font-size: 50px;
    }


    .section-heading {

        margin:
            11px 2px 7px;
    }


    .section-number {

        width: 30px;

        height: 30px;

        border-radius: 9px;

        font-size: 9px;
    }


    .section-heading h2 {

        font-size: 16px;
    }


    .section-heading p {

        font-size: 9px;
    }


    .levels {

        gap: 6px;
    }


    .level-card {

        min-height: 61px;

        padding:
            6px 8px;

        gap: 9px;

        border-radius: 14px;
    }


    .level-badge {

        width: 55px;

        min-width: 55px;

        height: 43px;

        border-radius: 11px;

        font-size: 18px;
    }


    .level-card h3 {

        margin-bottom: 1px;

        font-size: 13px;
    }


    .level-card p {

        font-size: 9px;

        line-height: 1.25;
    }


    .select-circle {

        width: 22px;

        height: 22px;

        font-size: 10px;
    }


    .categories {

        grid-template-columns:
            repeat(3, 1fr);

        gap: 6px;
    }


    .category-card {

        min-height: 88px;

        padding:
            6px 3px;

        border-radius: 14px;
    }


    .category-icon {

        width: 39px;

        height: 39px;

        margin-bottom: 4px;

        border-radius: 11px;

        font-size: 23px;
    }


    .category-card strong {

        font-size: 11px;

        margin-bottom: 1px;
    }


    .category-card small {

        font-size: 8px;
    }


    .category-check {

        top: 4px;

        right: 4px;

        width: 19px;

        height: 19px;

        font-size: 9px;
    }


    .selection-message {

        margin-top: 10px;

        padding:
            8px 10px;

        font-size: 9px;
    }


    .start-btn {

        min-height: 49px;

        border-radius: 14px;

        font-size: 15px;
    }

}


/* =========================================================
   جوالات صغيرة جدًا
========================================================= */

@media (max-width: 380px) {

    .topbar {

        min-height: 56px;

        padding:
            7px 10px;
    }


    .page-title {

        font-size: 16px;
    }


    .back-btn {

        padding:
            7px 9px;

        font-size: 11px;
    }


    .container {

        padding:
            10px 10px 65px;
    }


    .intro {

        min-height: 115px;

        padding:
            14px 15px;
    }


    .intro h1 {

        font-size: 21px;
    }


    .intro p {

        max-width: 215px;

        font-size: 9px;
    }


    .intro::after {

        font-size: 43px;
    }


    .floating-book {

        font-size: 43px;
    }


    .section-heading h2 {

        font-size: 15px;
    }


    .level-card {

        min-height: 57px;
    }


    .level-badge {

        width: 51px;

        min-width: 51px;

        height: 40px;

        font-size: 17px;
    }


    .level-card h3 {

        font-size: 12px;
    }


    .level-card p {

        font-size: 8px;
    }


    .category-card {

        min-height: 82px;
    }


    .category-icon {

        width: 36px;

        height: 36px;

        font-size: 21px;
    }


    .category-card strong {

        font-size: 10px;
    }


    .category-card small {

        font-size: 7px;
    }


    .start-btn {

        min-height: 46px;

        font-size: 14px;
    }

}