@import url("https://fonts.bunny.net/css?family=noto-naskh-arabic:400,500,600,700|noto-nastaliq-urdu:400,700&display=swap");

.kua-tool {
    --p: #0f766e;
    --pd: #115e59;
    --ink: #183f3c;
    --muted: #475569;
    --line: #99f6e4;
    --soft: #f0fdfa;
    --urdu: "Noto Nastaliq Urdu", "Noto Naskh Arabic", "Urdu Typesetting", "Segoe UI", Tahoma, sans-serif;
    --naskh: "Noto Naskh Arabic", "Noto Nastaliq Urdu", "Urdu Typesetting", "Segoe UI", Tahoma, sans-serif;
    display: flex;
    flex-direction: column;
    gap: clamp(14px, 2vw, 22px);
    padding: clamp(1rem, 3vw, 2rem);
    border: 1px solid #ccfbf1;
    border-radius: 24px;
    background: linear-gradient(145deg, #fbfffe, #f0fdfa 58%, #fff7ed);
    color: var(--ink);
    box-shadow: 0 18px 50px rgba(17, 94, 89, .08);
    min-width: 0;
    overflow: visible;
}

.kua-tool * {
    box-sizing: border-box;
}

.kua-tool [lang="ur"],
.kua-urdu {
    font-family: var(--urdu);
    font-weight: 400;
    letter-spacing: 0;
    line-height: 2;
    direction: rtl;
    unicode-bidi: isolate;
}

/* Hero */
.kua-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    margin: 0;
}

.kua-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.kua-brand > div:last-child {
    min-width: 0;
}

.kua-logo {
    width: 78px;
    height: 72px;
    display: grid;
    place-items: center;
    flex: none;
    border: 4px solid #fff;
    border-radius: 20px;
    background: linear-gradient(145deg, #2dd4bf, var(--p));
    color: #fff;
    font-family: var(--naskh);
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.2;
    direction: rtl;
    overflow: visible;
    box-shadow: 0 8px 20px rgba(15, 118, 110, .22);
}

.kua-kicker {
    display: block;
    margin: 0 0 6px;
    color: var(--p);
    font-family: var(--naskh);
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.8;
    direction: rtl;
}

.kua-hero h2 {
    margin: .15rem 0;
    font-size: clamp(1.45rem, 3vw, 2rem);
    line-height: 1.2;
    color: var(--ink);
}

.kua-hero p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: .95rem;
    line-height: 1.55;
}

.kua-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .55rem;
}

.kua-stats div {
    min-width: 0;
    padding: .7rem .55rem;
    border: 1px solid #ccfbf1;
    border-radius: 13px;
    background: #fff;
    text-align: center;
}

.kua-stats strong {
    display: block;
    color: var(--p);
    font-size: 1.15rem;
    line-height: 1.2;
}

.kua-stats small {
    display: block;
    margin-top: 4px;
    font-size: .68rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 700;
}

/* Settings */
.kua-settings {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    padding: clamp(14px, 2vw, 20px);
    border: 1px solid #ccfbf1;
    border-radius: 15px;
    background: #fff;
}

.kua-settings label:first-child {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    min-width: 0;
}

.kua-settings label:first-child > span {
    color: var(--p);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.kua-settings select {
    min-width: min(220px, 100%);
    min-height: 42px;
    padding: .45rem .7rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    font-weight: 700;
}

.kua-auto {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    font-weight: 700;
    color: var(--muted);
    white-space: nowrap;
}

.kua-auto input {
    width: 16px;
    height: 16px;
    accent-color: var(--p);
}

/* Tabs */
.kua-tabs {
    display: flex;
    gap: .45rem;
    margin: 0;
    padding: 6px;
    border: 1px solid #ccfbf1;
    border-radius: 14px;
    background: #fff;
}

.kua-tabs button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    flex: 1;
    min-height: 44px;
    padding: .55rem .75rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.kua-tabs button.is-active {
    background: var(--soft);
    color: var(--pd);
    box-shadow: 0 3px 9px rgba(17, 94, 89, .1);
}

.kua-tabs span[lang="ur"] {
    font-family: var(--naskh);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Panels */
.kua-panel {
    padding: clamp(16px, 2.6vw, 28px);
    border: 1px solid #ccfbf1;
    border-radius: 20px;
    background: #fff;
    min-width: 0;
    overflow: visible;
}

.kua-panel[hidden] {
    display: none !important;
}

.kua-head,
.kua-round {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
}

.kua-head b {
    display: block;
    color: var(--ink);
    font-size: 1.05rem;
}

.kua-head p {
    margin: .35rem 0 0;
    color: var(--muted);
    font-size: .88rem;
    line-height: 1.45;
}

.kua-head > span,
.kua-round {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
}

.kua-round span[lang="ur"],
#KidsUrduAlphabetEncouragement {
    font-family: var(--naskh);
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--pd);
}

.kua-progress {
    height: 8px;
    margin: 10px 0 16px;
    border-radius: 99px;
    background: #e2e8f0;
    overflow: hidden;
}

.kua-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--p), #f59e0b);
    border-radius: inherit;
}

/* Letter grid — Naskh for clear isolated letters */
.kua-grid {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 8px;
    max-height: none;
    overflow: visible;
}

.kua-letter {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 56px;
    padding: .35rem .2rem;
    border: 2px solid #d1fae5;
    border-radius: 11px;
    background: #fff;
    color: var(--ink);
    font-family: var(--naskh);
    font-size: clamp(1.25rem, 2.4vw, 1.55rem);
    font-weight: 700;
    line-height: 1.35;
    direction: rtl;
    cursor: pointer;
    overflow: visible;
}

.kua-letter.is-active {
    border-color: var(--p);
    background: var(--p);
    color: #fff;
}

.kua-letter.is-explored::after {
    content: "";
    position: absolute;
    right: 5px;
    top: 5px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #f59e0b;
}

/* Detail card */
.kua-detail {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    margin-top: 18px;
    padding: clamp(16px, 2.5vw, 24px);
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--soft);
    overflow: visible;
}

.kua-big {
    width: 110px;
    height: 110px;
    display: grid;
    place-items: center;
    border: 4px solid #fff;
    border-radius: 22px;
    background: linear-gradient(145deg, #2dd4bf, var(--p));
    color: #fff;
    font-family: var(--naskh);
    font-size: 3.2rem;
    font-weight: 700;
    line-height: 1;
    direction: rtl;
    overflow: visible;
}

.kua-type {
    display: inline-block;
    padding: .28rem .55rem;
    border-radius: 99px;
    background: #ccfbf1;
    color: var(--pd);
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.kua-detail h3 {
    margin: .45rem 0;
    color: var(--ink);
    font-size: clamp(1.15rem, 2.5vw, 1.45rem);
    line-height: 1.7;
    font-weight: 800;
}

.kua-detail h3 [lang="ur"],
.kua-example,
.kua-target {
    font-family: var(--urdu);
    letter-spacing: 0;
}

.kua-example {
    margin: .35rem 0;
    color: var(--pd);
    font-size: clamp(1.25rem, 2.8vw, 1.55rem);
    font-weight: 500;
    line-height: 2.1;
    direction: rtl;
    text-align: right;
}

.kua-detail p:not(.kua-example) {
    margin: .25rem 0 .75rem;
    color: var(--muted);
    font-size: .95rem;
    line-height: 1.5;
}

.kua-nav {
    width: 42px;
    height: 52px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--p);
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
}

.kua-action {
    min-width: 170px;
    min-height: 44px;
    padding: .6rem .9rem;
    border: 2px solid var(--p);
    border-radius: 10px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.kua-primary {
    background: var(--p);
    color: #fff;
}

.kua-outline {
    background: #fff;
    color: var(--pd);
}

.kua-action:disabled {
    opacity: .5;
    cursor: default;
}

/* Quiz */
.kua-quiz-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.kua-quiz-head h3 {
    margin: .25rem 0 0;
    color: var(--ink);
    font-size: 1.25rem;
}

.kua-quiz-head .kua-kicker {
    font-size: .95rem;
}

.kua-quiz-head label {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.kua-quiz-head select {
    min-height: 40px;
    min-width: 180px;
    padding: .45rem .6rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--ink);
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
}

.kua-quiz-card {
    max-width: 720px;
    margin: 0 auto;
    padding: clamp(18px, 2.6vw, 28px);
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--soft);
    text-align: center;
    overflow: visible;
}

.kua-quiz-card > span {
    display: inline-block;
    padding: .28rem .55rem;
    border-radius: 99px;
    background: #ccfbf1;
    color: var(--pd);
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.kua-quiz-card > p {
    margin: 12px 0 8px;
    color: var(--ink);
    font-size: clamp(1.05rem, 2.4vw, 1.25rem);
    font-weight: 800;
    line-height: 1.4;
}

.kua-target {
    min-height: 56px;
    display: grid;
    place-items: center;
    color: var(--p);
    font-size: clamp(1.45rem, 3.2vw, 1.9rem);
    font-weight: 500;
    line-height: 2.2;
    direction: rtl;
    overflow: visible;
}

.kua-choices {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0;
}

.kua-choice {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 72px;
    padding: .75rem .35rem .5rem;
    border: 2px solid #ccfbf1;
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    overflow: visible;
}

.kua-choice span {
    position: absolute;
    left: 6px;
    top: 6px;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: 5px;
    background: var(--soft);
    color: var(--p);
    font-size: .65rem;
    font-weight: 800;
}

.kua-choice b {
    display: block;
    font-family: var(--naskh);
    font-size: clamp(1.55rem, 3vw, 1.9rem);
    font-weight: 700;
    font-style: normal;
    line-height: 1.35;
    direction: rtl;
}

.kua-choice.is-correct {
    border-color: #22c55e;
    background: #dcfce7;
}

.kua-choice.is-wrong {
    border-color: #ef4444;
    background: #fee2e2;
}

.kua-choice:disabled:not(.is-correct):not(.is-wrong) {
    opacity: .45;
}

.kua-feedback {
    margin: 14px 0;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: .9rem;
    font-weight: 750;
    line-height: 1.45;
    color: var(--ink);
}

.kua-feedback.is-info {
    background: #ecfeff;
    color: #155e75;
}

.kua-feedback.is-success {
    background: #dcfce7;
    color: #14532d;
}

.kua-feedback.is-error {
    background: #fee2e2;
    color: #7f1d1d;
}

.kua-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.kua-summary {
    margin-top: 1rem;
    padding: 1.25rem;
    border: 1px solid #fde68a;
    border-radius: 17px;
    background: #fffbeb;
    text-align: center;
}

.kua-summary[hidden] {
    display: none !important;
}

.kua-summary > div {
    color: #d97706;
    font-size: 1.5rem;
}

.kua-summary h3 {
    margin: .4rem 0;
    color: var(--ink);
    font-size: 1.35rem;
    line-height: 1.8;
    letter-spacing: 0;
}

.kua-summary h3 [lang="ur"] {
    font-family: var(--naskh);
    font-weight: 700;
}

.kua-summary p {
    margin: 0 0 1rem;
    color: var(--muted);
    line-height: 1.55;
}

.kua-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 0 4px;
    color: var(--muted);
    font-size: .82rem;
}

.kua-footer button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

@media (max-width: 900px) {
    .kua-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }

    .kua-choices {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 780px) {
    .kua-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .kua-stats {
        width: 100%;
    }

    .kua-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (max-width: 580px) {
    .kua-tool {
        gap: 14px;
        padding: 14px;
        border-radius: 18px;
    }

    .kua-brand {
        align-items: flex-start;
    }

    .kua-logo {
        width: 64px;
        height: 60px;
        border-radius: 16px;
        font-size: 1.25rem;
    }

    .kua-kicker {
        font-size: .88rem;
    }

    .kua-hero p {
        font-size: .9rem;
    }

    .kua-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kua-settings,
    .kua-quiz-head {
        align-items: stretch;
        flex-direction: column;
    }

    .kua-settings select,
    .kua-quiz-head select {
        width: 100%;
        min-width: 0;
    }

    .kua-auto {
        white-space: normal;
    }

    .kua-tabs {
        flex-direction: column;
    }

    .kua-panel {
        padding: 14px;
    }

    .kua-head,
    .kua-round,
    .kua-footer {
        gap: 8px;
        align-items: flex-start;
        flex-direction: column;
    }

    .kua-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 7px;
    }

    .kua-letter {
        min-height: 50px;
        font-size: 1.25rem;
    }

    .kua-detail {
        grid-template-columns: 36px 1fr 36px;
        gap: 14px;
        padding: 16px 12px;
        text-align: center;
    }

    .kua-big {
        grid-column: 2;
        width: 96px;
        height: 96px;
        margin: auto;
        font-size: 2.8rem;
    }

    .kua-detail > div:nth-of-type(2) {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .kua-example {
        text-align: center;
    }

    .kua-choices {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .kua-actions {
        flex-direction: column-reverse;
    }

    .kua-action {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 380px) {
    .kua-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
