:root {
    --bg: var(--tg-theme-bg-color, #f5f7fb);
    --text: var(--tg-theme-text-color, #172033);
    --hint: var(--tg-theme-hint-color, #6b7280);
    --card: var(--tg-theme-secondary-bg-color, #ffffff);
    --button: var(--tg-theme-button-color, #2563eb);
    --button-text: var(--tg-theme-button-text-color, #ffffff);
    --border: rgba(100, 116, 139, 0.18);
    --green: #16a34a;
    --green-bg: #dcfce7;
    --red: #dc2626;
    --red-bg: #fee2e2;
}

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

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
    background: var(--bg);
    color: var(--text);
}

body {
    padding: 14px;
}

button {
    font-family: inherit;
}

.app {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
}

.top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 18px;
    background: var(--card);
    border: 1px solid var(--border);
}

.logo {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--button);
    font-size: 25px;
    flex-shrink: 0;
}

.title {
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
}

.subtitle {
    margin-top: 4px;
    color: var(--hint);
    font-size: 13px;
}

.welcome,
.test-card,
.result-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 20px;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
}

.welcome {
    text-align: center;
    padding-top: 32px;
    padding-bottom: 32px;
}

.big-icon {
    font-size: 54px;
    margin-bottom: 14px;
}

.welcome h1,
.result-card h1 {
    margin: 0 0 10px;
    font-size: 23px;
    line-height: 1.25;
}

.welcome p {
    margin: 8px 0;
    color: var(--hint);
    line-height: 1.5;
}

.main-btn {
    width: 100%;
    border: 0;
    border-radius: 15px;
    padding: 15px 18px;
    margin-top: 18px;
    background: var(--button);
    color: var(--button-text);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
}

.main-btn:active {
    transform: scale(0.98);
}

.test-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.module-name {
    font-size: 14px;
    font-weight: 800;
}

.counter {
    color: var(--hint);
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.progress {
    width: 100%;
    height: 7px;
    margin-bottom: 22px;
    border-radius: 99px;
    overflow: hidden;
    background: rgba(100, 116, 139, 0.15);
}

.progress-fill {
    height: 100%;
    border-radius: inherit;
    background: var(--button);
    transition: width 0.25s ease;
}

.question {
    font-size: 19px;
    font-weight: 750;
    line-height: 1.5;
    margin-bottom: 20px;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.option-btn {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 14px;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    font-size: 15px;
    line-height: 1.4;
    transition:
        transform 0.12s ease,
        border-color 0.15s ease,
        background 0.15s ease;
}

.option-btn:active {
    transform: scale(0.985);
}

.option-btn:disabled {
    cursor: default;
}

.option-letter {
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--button);
    font-weight: 900;
}

.option-text {
    padding-top: 5px;
}

.option-btn.correct {
    border-color: var(--green);
    background: var(--green-bg);
}

.option-btn.correct .option-letter {
    background: var(--green);
    color: #ffffff;
}

.option-btn.wrong {
    border-color: var(--red);
    background: var(--red-bg);
}

.option-btn.wrong .option-letter {
    background: var(--red);
    color: #ffffff;
}

.feedback {
    min-height: 55px;
    margin-top: 15px;
}

.feedback-success,
.feedback-error {
    border-radius: 14px;
    padding: 13px 14px;
    font-size: 15px;
    line-height: 1.45;
    font-weight: 700;
}

.feedback-success {
    color: var(--green);
    background: var(--green-bg);
}

.feedback-error {
    color: var(--red);
    background: var(--red-bg);
}

.result-card {
    text-align: center;
    padding-top: 30px;
    padding-bottom: 30px;
}

.result-icon {
    font-size: 58px;
    margin-bottom: 10px;
}

.result-module {
    color: var(--hint);
    line-height: 1.45;
    font-size: 14px;
}

.result-percent {
    margin: 22px 0;
    font-size: 54px;
    font-weight: 900;
    line-height: 1;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
    margin-top: 20px;
}

.stat {
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 13px 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat span {
    font-size: 20px;
}

.stat b {
    font-size: 20px;
}

.stat small {
    color: var(--hint);
    font-size: 11px;
}

@media (max-width: 430px) {
    body {
        padding: 9px;
    }

    .top {
        padding: 11px;
    }

    .test-card,
    .result-card,
    .welcome {
        padding: 16px;
        border-radius: 18px;
    }

    .question {
        font-size: 17px;
    }

    .option-btn {
        font-size: 14px;
        padding: 12px;
    }

    .result-percent {
        font-size: 48px;
    }
}

/* ===== ADMIN PANEL BUTTON ===== */

.admin-panel-button {
    margin-top: 24px;
    padding: 0 12px 18px;
    text-align: center;
}

.admin-panel-button button {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card);
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.admin-panel-button button:active {
    transform: scale(0.98);
}


