
/* ===== Telegram temasiga moslashuvchi o'zgaruvchilar ===== */
:root {
    --bg: var(--tg-theme-bg-color, #ffffff);
    --text: var(--tg-theme-text-color, #000000);
    --hint: var(--tg-theme-hint-color, #8e8e93);
    --link: var(--tg-theme-link-color, #2481cc);
    --btn: var(--tg-theme-button-color, #2481cc);
    --btn-text: var(--tg-theme-button-text-color, #ffffff);
    --sec: var(--tg-theme-secondary-bg-color, #f4f4f5);
    --border: var(--tg-theme-hint-color, #e0e0e0);
    --green: #10b981;
    --red: #ef4444;
    --gold: #f59e0b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding: 16px;
    padding-bottom: 80px;
    line-height: 1.5;
}

/* ===== Ekranlarni boshqarish ===== */
.screen { display: none; }
.screen.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Profil Header ===== */
.profile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: linear-gradient(135deg, var(--btn), #1e5c9e);
    color: #fff;
    border-radius: 18px;
    margin-bottom: 20px;
}

.avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-info h2 { font-size: 18px; margin-bottom: 2px; }
.profile-info p { font-size: 13px; opacity: .85; }

/* ===== Kartochkalar ===== */
.cards-container { display: flex; flex-direction: column; gap: 12px; }

.card {
    background: var(--sec);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card:active { transform: scale(0.98); }
.card-icon { font-size: 32px; flex-shrink: 0; }
.card h3 { font-size: 16px; margin-bottom: 2px; }
.card p { font-size: 13px; color: var(--hint); }

.badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 600;
    display: inline-block;
    margin-top: 4px;
}

.badge.monthly { background: rgba(37,99,235,.12); color: #2563eb; }
.badge.yearly { background: rgba(16,185,129,.12); color: var(--green); }
.badge.warn { background: rgba(239,68,68,.12); color: var(--red); }

.tag { display: inline-block; margin-top: 4px; margin-left: 4px; }
.tag.warn { background: rgba(239,68,68,.12); color: var(--red); font-size: 11px; padding: 3px 8px; border-radius: 10px; font-weight: 600; }

/* ===== Tugmalar ===== */
.btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    margin-top: 10px;
}

.btn-p { background: var(--btn); color: var(--btn-text); }
.btn-s { background: var(--sec); color: var(--text); }

/* ===== Test Interfeysi ===== */
.timer { font-size: 24px; font-weight: 700; text-align: center; margin: 10px 0; }
.timer.warn { color: var(--red); }

.pbar {
    height: 6px;
    background: var(--sec);
    border-radius: 3px;
    margin-bottom: 18px;
    overflow: hidden;
}

.pfill { height: 100%; background: var(--btn); transition: width 0.3s; border-radius: 3px; }

.test-header { display: flex; justify-content: space-between; margin-bottom: 15px; }
.q-num { font-weight: 600; }
.q-score { color: var(--green); font-weight: 700; }
.q-text { font-size: 17px; font-weight: 600; margin-bottom: 20px; }

.options { display: flex; flex-direction: column; gap: 10px; }

.opt {
    width: 100%;
    background: var(--sec);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 14px;
    text-align: left;
    font-size: 15px;
    cursor: pointer;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: border-color 0.2s, background 0.2s;
}

.opt.correct { border-color: var(--green); background: rgba(16,185,129,.1); color: var(--green); }
.opt.wrong { border-color: var(--red); background: rgba(239,68,68,.1); color: var(--red); }

.letter {
    font-weight: 700;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: 50%;
    flex-shrink: 0;
}

/* ===== Natija ekrani ===== */
.result-screen { text-align: center; padding-top: 30px; }
.res-pct { font-size: 48px; font-weight: 800; margin: 20px 0; }
.res-stats { display: flex; gap: 20px; justify-content: center; margin-bottom: 30px; }

/* ===== Study Mode ===== */
.screen-title { margin-bottom: 15px; font-size: 20px; }
.screen-sub { color: var(--hint); margin-bottom: 20px; font-size: 14px; }

.search-input {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--sec);
    color: var(--text);
    margin-bottom: 15px;
    font-size: 15px;
    outline: none;
}

.search-input:focus { border-color: var(--btn); }

.study-list { display: flex; flex-direction: column; gap: 12px; }

.sitem { background: var(--sec); border-radius: 12px; padding: 14px; }
.sitem .q { font-weight: 600; margin-bottom: 10px; }

.sopt { padding: 8px; border-radius: 8px; margin-top: 6px; font-size: 14px; }
.sopt.correct { background: rgba(16,185,129,.15); color: var(--green); font-weight: 600; }

/* ===== Interview Accordion ===== */
.qa-list { display: flex; flex-direction: column; gap: 10px; }

.qa { background: var(--sec); border-radius: 12px; overflow: hidden; }

.qa-q {
    padding: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.qa-a {
    padding: 0 14px 14px;
    display: none;
    font-size: 14px;
    color: var(--hint);
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.qa.open .qa-a { display: block; }
.qa.open .arr { transform: rotate(180deg); }
.arr { transition: transform 0.3s; }

/* ===== Mock Interview ===== */
.mock-list { display: flex; flex-direction: column; gap: 15px; margin-bottom: 20px; }

.sta {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    resize: vertical;
    margin-top: 10px;
    outline: none;
    font-family: inherit;
}

.sta:focus { border-color: var(--btn); }

.mock-total { text-align: center; margin-bottom: 20px; }
.mock-results { display: flex; flex-direction: column; gap: 12px; }

.m-card {
    background: var(--sec);
    border-radius: 12px;
    padding: 14px;
    border-left: 4px solid var(--hint);
}

.m-card .head { display: flex; justify-content: space-between; margin-bottom: 10px; }
.m-card .score { font-weight: 700; }
.m-card details { margin-top: 8px; }
.m-card summary { cursor: pointer; color: var(--link); font-size: 13px; }

/* ===== Loading ===== */
.loading-screen { text-align: center; padding: 50px 20px; }

.spinner {
    border: 3px solid var(--sec);
    border-top: 3px solid var(--btn);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}