/* ======================================
   GLOBAL
====================================== */
:root {
    --bg-main: #eef3ff;
    --card-bg: #ffffff;
    --text-main: #14172a;
    --accent-1: #4a5cff;
    --accent-2: #34cae3;
    --accent-good: #28c76f;
    --accent-bad: #ff4b4b;
    --shadow-soft: 0 12px 30px rgba(94, 110, 178, 0.18);
    --timer-progress: 0;
    /* 0–100 JS bilan yangilanadi */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
    background: radial-gradient(circle at top, #f7f8ff 0%, #dde5ff 40%, #eef3ff 100%);
    color: var(--text-main);
}

/* Telegram WebApp ichida scroll chiroyli bo‘lishi uchun */
body::-webkit-scrollbar {
    width: 0;
}

/* ======================================
   PAGE SISTEMA
====================================== */

#app {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
}

.page {
    display: none;
    padding: 22px 18px 28px;
    animation: fadeIn .3s ease-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-space {
    height: 14px;
}

/* ======================================
   START PAGE
====================================== */

.start-icon {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    margin-bottom: 10px;
}

.icon-circle {
    width: 108px;
    height: 108px;
    border-radius: 26px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 40px;
    box-shadow: 0 18px 40px rgba(74, 92, 255, 0.45);
    position: relative;
    overflow: hidden;
}

.icon-circle::after {
    content: "";
    position: absolute;
    width: 130%;
    height: 130%;
    background: radial-gradient(circle at top, rgba(255, 255, 255, .45), transparent 60%);
    opacity: 0.8;
    transform: translateY(-20%);
}

.test-title {
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    margin-top: 12px;
}

/* Info boxes */

.info-row {
    display: flex;
    gap: 14px;
    margin-top: 24px;
}

.box {
    flex: 1;
    background: var(--card-bg);
    border-radius: 18px;
    padding: 18px 14px;
    box-shadow: var(--shadow-soft);
    text-align: center;
}

.box-icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 6px;
    font-size: 24px;
}

.box-icon.purple {
    background: #efe7ff;
    color: #7a3eff;
}

.box-icon.cyan {
    background: #e0fbff;
    color: #009cbd;
}

.box h3 {
    font-size: 24px;
    margin-bottom: 4px;
}

.box p {
    font-size: 13px;
    opacity: .8;
}

/* Features text */

.feature-list {
    margin-top: 22px;
    font-size: 14px;
    line-height: 1.6;
    opacity: .9;
}

/* Start button */

.start-btn {
    width: 100%;
    margin-top: 24px;
    padding: 14px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    box-shadow: 0 14px 32px rgba(74, 93, 255, 0.45);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}

.start-btn:active {
    transform: translateY(1px) scale(.98);
    box-shadow: 0 8px 20px rgba(74, 93, 255, 0.3);
}

/* ======================================
   TEST PAGE
====================================== */

.test-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 10px 14px;
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 14px;
}

/* Timer with circular progress ring */
.time-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    position: relative;
    padding-left: 38px;
}

/* Ring container */
.time-box::before {
    content: "";
    position: absolute;
    left: 0;
    top: 2px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background:
        conic-gradient(var(--accent-2) calc(var(--timer-progress) * 1%),
            #d7defc 0);
    box-shadow: 0 0 8px rgba(52, 202, 227, 0.5);
}

/* Inner circle (white center) */
.time-box::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
}

/* Icon position */
.time-box i {
    position: absolute;
    left: 6px;
    top: 8px;
    font-size: 15px;
    color: var(--accent-1);
}

.time-box span {
    font-weight: 600;
}

/* Savol soni */

.question-count {
    font-size: 15px;
    font-weight: 500;
}

/* Progress chizig‘i */

.test-progress {
    width: 100%;
    height: 6px;
    background: #dde2ff;
    border-radius: 20px;
    margin: 14px 0 10px;
    overflow: hidden;
}

#progressBar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
    border-radius: 20px;
    transition: width .3s ease;
}

/* Savol matni */

.question-text {
    font-size: 19px;
    font-weight: 600;
    margin: 16px 0 12px;
}

/* Variantlar */

#optionsArea {
    margin-top: 4px;
}

.option {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 12px 13px;
    margin-bottom: 10px;
    font-size: 15px;
    box-shadow: 0 10px 22px rgba(164, 175, 214, 0.18);
    border: 2px solid transparent;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
}

.option::before {
    content: "";
    position: absolute;
    left: -20%;
    top: 0;
    width: 40%;
    height: 100%;
    background: linear-gradient(120deg, rgba(255, 255, 255, .9), transparent);
    opacity: 0;
    transform: skewX(-20deg);
}

.option:active {
    transform: scale(.985);
}

.option:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(160, 170, 220, 0.25);
}

/* To‘g‘ri/nota'g‘ri holatlar */

.option.correct {
    background: #e8ffef;
    border-color: var(--accent-good);
    animation: optGreen .25s ease-out;
}

.option.wrong {
    background: #ffeaea;
    border-color: var(--accent-bad);
    animation: optRed .25s ease-out;
}

@keyframes optGreen {
    from {
        box-shadow: 0 0 0 rgba(40, 199, 111, 0.0);
    }

    to {
        box-shadow: 0 0 20px rgba(40, 199, 111, 0.45);
    }
}

@keyframes optRed {
    from {
        box-shadow: 0 0 0 rgba(255, 75, 75, 0.0);
    }

    to {
        box-shadow: 0 0 20px rgba(255, 75, 75, 0.45);
    }
}

/* Keyingi tugma */

.next-btn {
    width: 100%;
    margin-top: 14px;
    padding: 13px;
    border-radius: 14px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: #fff;
    opacity: .4;
    cursor: default;
    transition: opacity .15s ease, transform .15s ease, box-shadow .15s ease;
}

.next-btn.active {
    opacity: 1;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(74, 92, 255, 0.4);
}

.next-btn.active:active {
    transform: translateY(1px) scale(.985);
}

/* Navigator (pastdagi kichik doiralar) */

#navigator {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.nav-dot {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #dde2ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #51557a;
}

.nav-dot.current {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: #fff;
}

.nav-dot.answered {
    background: #c4f7d8;
    color: #0e7a3a;
}

/* ======================================
   RESULT PAGE
====================================== */

.end-title {
    text-align: center;
    font-size: 26px;
    margin-top: 10px;
    margin-bottom: 14px;
}

.end-title i {
    color: #f5b400;
    margin-right: 4px;
}

.result-box {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 14px;
    text-align: center;
}

.result-box h3 {
    font-size: 22px;
    margin-bottom: 4px;
}

.result-box p {
    font-size: 13px;
    opacity: .8;
}

.result-box.green {
    border-left: 5px solid var(--accent-good);
}

.result-box.blue {
    border-left: 5px solid var(--accent-1);
}

.result-box.purple {
    border-left: 5px solid #c55bff;
}

.result-status {
    text-align: center;
    margin-top: 6px;
    font-size: 14px;
}

/* ======================================
   REVIEW PAGE — PREMIUM
====================================== */

.review-title {
    font-size: 26px;
    margin-bottom: 16px;
    font-weight: 700;
    text-align: center;
}

/* Ortga qaytish tugmasi */
.back-btn {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #ccd4ff, #b7c5ff);
    color: #1a1b33;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 18px;
    box-shadow: 0 10px 20px rgba(150, 160, 255, 0.35);
    transition: 0.2s ease;
}

.back-btn:active {
    transform: scale(0.96);
}

/* Review card */
.review-card {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 12px 24px rgba(150, 160, 210, 0.22);
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: 0.25s ease;
}

/* To‘g‘ri javob bo‘lsa kartani yashil qilish */
.review-card.correct {
    border-color: rgba(40, 199, 111, 0.45);
    box-shadow: 0 12px 30px rgba(40, 199, 111, 0.3);
}

/* Xato bo‘lsa kartani qizil qilish */
.review-card.wrong {
    border-color: rgba(255, 75, 75, 0.45);
    box-shadow: 0 12px 30px rgba(255, 75, 75, 0.3);
}

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

/* Savol sarlavhasi */
.review-question {
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ✔ / ✘ belgisi */
.review-question.correct::after {
    content: "✔";
    color: var(--accent-good);
}

.review-question.wrong::after {
    content: "✘";
    color: var(--accent-bad);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 4px;
}

.badge.correct {
    background: #dbffe9;
    color: #0d8d45;
}

.badge.wrong {
    background: #ffe1e1;
    color: #c41919;
}

/* Matnlar */
.text-correct {
    color: #0d8d45;
    font-weight: 700;
}

.text-wrong {
    color: #d22a2a;
    font-weight: 700;
}

/* Yengil animatsiya klassi */

.fade-up {
    animation: fadeUp .25s ease-out;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsiv kichik tuzatishlar */

@media (max-width: 400px) {
    .test-title {
        font-size: 23px;
    }

    /* .info-row {
        flex-direction: column;
    }

    .box {
        padding: 16px 14px;
    } */
}

.question-image {
    width: 100%;
    display: block;
    border-radius: 14px;
    margin: 12px 0;
    box-shadow: 0 10px 20px rgba(120, 130, 180, 0.25);
}