/* ===== BODY ===== */
body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: #111827; 
}

/* ===== CARD ===== */
.card {
    position: relative;
    z-index: 20;
    background: #ffffff;
    width: min(88vw, 420px);
    max-width: 420px;
    padding: clamp(18px, 3.8vw, 22px);
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.2);
    animation: fade 0.4s ease;
    text-align: center;
    color: #111827;
}

@media (max-width: 640px) {
    .card {
        width: min(86vw, 390px);
        padding: 18px 16px;
        border-radius: 16px;
    }
}

@media (max-width: 380px) {
    .card {
        width: min(84vw, 360px);
        padding: 12px 12px;
        border-radius: 17px;
    }
}

.ai-options-note {
    width: min(88vw, 420px);
    box-sizing: border-box;
    margin: 0 auto 10px;
    padding: 7px 12px;
    border: 1px solid rgba(255,255,255,0.34);
    border-radius: 999px;
    background: rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.92);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    letter-spacing: 0.15px;
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

@media (max-width: 640px) {
    .ai-options-note {
        width: min(86vw, 390px);
        margin-bottom: 8px;
        padding: 6px 10px;
        font-size: 10.5px;
    }
}

@media (max-width: 380px) {
    .ai-options-note {
        width: min(84vw, 360px);
        font-size: 10px;
    }
}

/* ===== HEADER ===== */
h2 {
    margin: 0 0 12px;
    text-align: center;
    color: #111827;
}


.test-top-actions {
    position: relative;
    z-index: 21;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 42px;
    margin-bottom: 10px;
}

.test-top-actions:empty {
    display: none;
}

.top-finish-btn {
    position: relative;
    z-index: 22;
    padding: 10px 15px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #4338ca 0%, #7c3aed 100%);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2px;
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.26);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.top-finish-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(91, 33, 182, 0.28);
    filter: brightness(1.04);
}

.favorite-question-btn {
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-width: 48px;
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 14px;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(99, 102, 241, 0.14);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.favorite-question-btn:hover,
.favorite-question-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(99, 102, 241, 0.18);
}

.favorite-question-btn.is-active {
    background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.34);
    box-shadow: 0 10px 22px rgba(245, 158, 11, 0.2);
}

.question-favorite-btn {
    margin-right: 10px;
}

.test-top-actions {
    gap: 10px;
}

.study-question-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.study-favorite-btn {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 12px;
    font-size: 22px;
}

.app-favorites-toggle {
    position: fixed;
    top: 20px;
    left: 92px;
    z-index: 55;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    color: #4f46e5;
    font-size: 28px;
    font-weight: 800;
    box-shadow: 0 14px 26px rgba(30, 41, 59, 0.16);
    backdrop-filter: blur(12px);
    cursor: pointer;
}

.app-favorites-toggle.is-hidden {
    display: none !important;
}

.app-favorites-toggle.is-active,
.app-favorites-toggle:hover {
    color: #b45309;
    background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
}

@media (max-width: 640px) {
    .favorite-question-btn {
        width: 46px;
        height: 46px;
        min-width: 46px;
        border-radius: 13px;
        font-size: 22px;
    }

    .study-favorite-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 20px;
    }

    .app-favorites-toggle {
        top: 20px;
        left: 90px;
        width: 54px;
        height: 54px;
        border-radius: 17px;
        font-size: 26px;
    }
}

.premium-incognito-toggle {
    position: fixed;
    top: 14px;
    left: 74px;
    z-index: 1600;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 16px;
    background: rgba(255,255,255,0.92);
    color: #0f766e;
    font-size: 26px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 10px 24px rgba(0,0,0,0.18);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.premium-incognito-toggle.is-hidden {
    display: none !important;
}

.premium-incognito-toggle-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.premium-incognito-toggle.is-active {
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    color: #e2e8f0;
}

.premium-incognito-toggle.is-active .premium-incognito-toggle-icon::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2.5px;
    border-radius: 999px;
    background: currentColor;
    transform: rotate(-35deg);
}

.premium-incognito-toggle:hover {
    transform: translateY(-1px);
}

@media (max-width: 640px) {
    .premium-incognito-toggle {
        top: 14px;
        left: 64px;
        width: 50px;
        height: 50px;
        border-radius: 16px;
        font-size: 24px;
    }
}

/* ===== TIMER ===== */
#timer {
    font-weight: 600;
    color: #4f46e5;
    margin-bottom: 10px;
}

#timer.timer-hidden {
    display: none !important;
}

#timer.speed-mode {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 50%, #fde68a 100%);
    color: #9a3412;
    border: 1px solid rgba(249, 115, 22, 0.22);
    box-shadow: 0 12px 28px rgba(249, 115, 22, 0.14);
}

.timer-speed-label {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.timer-speed-value {
    font-size: 18px;
    font-weight: 900;
    color: #7c2d12;
}

/* ===== QUESTION BOX (ИСПРАВЛЕНО) ===== */
#question {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #000000 !important; /* Принудительно черный цвет */
    text-align: left;
    line-height: 1.4;
}

/* ===== PROGRESS TEXT (Вопрос 1 из 15 - ИСПРАВЛЕНО) ===== */

.progress-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 0;
    flex-wrap: wrap;
}

.speed-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: 999px;
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    color: #c2410c;
    border: 1px solid rgba(251, 146, 60, 0.26);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: 0 10px 22px rgba(249, 115, 22, 0.10);
}

.progress {
    display: block;
    font-size: 14px;
    font-weight: 800;
    color: #374151 !important; /* Темно-серый, почти черный */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 4px;
}

/* ===== OPTIONS ===== */
#options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

button.option {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    border: none;
    background: #f1f5f9;
    font-size: 16px;
    cursor: pointer;
    transition: 0.2s;
    color: #111827 !important; /* Всегда черный текст */
    text-align: center;
    opacity: 1; /* Чтобы не было прозрачности */
}

button.option:disabled {
    cursor: default;
    color: #111827 !important;
    opacity: 1;
}

button.option.selected {
    background: #eef2ff;
    box-shadow: inset 0 0 0 2px #6366f1;
    color: #1e3a8a !important;
}

button.option.correct {
    background: #dcfce7 !important;
    color: #166534 !important;
    border: 2px solid #22c55e;
}

button.option.wrong {
    background: #fee2e2 !important;
    color: #991b1b !important;
    border: 2px solid #ef4444;
}

/* ===== MAIN BUTTON ===== */
button.main {
    width: 100%;
    margin-top: 12px;
    padding: 14px;
    font-size: 16px;
    border-radius: 14px;
    border: none;
    background: #6366f1;
    color: white;
    cursor: pointer;
    transition: 0.2s;
}

button.main:disabled {
    background: #a5b4fc;
    color: #ffffff;
    cursor: not-allowed;
}

/* ===== NAV BUTTONS ===== */
.nav-buttons {
    display: flex;
    flex-direction: column;
    margin-top: 10px;
    gap: 12px;
}

.nav-arrows {
    display: flex;
    justify-content: space-between;
    gap: 4%;
}

.nav-arrows button {
    flex: 1;
    padding: 12px;
    border-radius: 14px;
    font-size: 16px;
    background: #6366f1;
    color: white;
    transition: 0.2s;
}

.finish-button-row {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 2px;
}

.finish-button-row .finish-test-btn {
    width: 100%;
    padding: 11px 14px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 600;
    border: 1px solid rgba(239, 68, 68, 0.18);
    background: linear-gradient(180deg, #fff7f7 0%, #ffe8e8 100%);
    color: #b91c1c;
    box-shadow: 0 10px 24px rgba(185, 28, 28, 0.10);
    transition: 0.2s;
}

.finish-button-row .finish-test-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(185, 28, 28, 0.14);
}

/* ===== TIMER WARNING ===== */
.timer.warning {
    color: #dc2626;
    font-weight: 700;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1 }
    50% { opacity: .6 }
    100% { opacity: 1 }
}

/* ===== INPUT / SELECT ===== */

.mode-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 8px 0 8px;
    width: 100%;
    align-items: stretch;
}


.mode-switch-btn {
    min-width: 0;
    width: 100%;
    padding: 12px 8px;
    border-radius: 14px;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #3730a3;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.mode-switch-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mode-lock {
    flex: 0 0 auto;
    font-size: 14px;
    line-height: 1;
}

.mode-switch-btn.premium-mode.locked {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #d1d5db;
    opacity: 0.86;
}

.mode-switch-btn.premium-mode.unlocked {
    border-color: #bbf7d0;
    background: #ecfdf5;
    color: #047857;
}

.mode-switch-btn.active {
    background: linear-gradient(135deg, #4338ca 0%, #7c3aed 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 10px 22px rgba(79, 70, 229, 0.22);
}

.mode-switch-btn:hover {
    transform: translateY(-1px);
}

body.dark-theme .mode-switch-btn {
    background: rgba(30, 41, 59, 0.94);
    border-color: rgba(129, 140, 248, 0.28);
    color: #c7d2fe;
}

body.dark-theme .mode-switch-btn.premium-mode.locked {
    background: rgba(15, 23, 42, 0.84);
    border-color: rgba(148, 163, 184, 0.24);
    color: #94a3b8;
}

body.dark-theme .mode-switch-btn.premium-mode.unlocked {
    background: rgba(20, 83, 45, 0.42);
    border-color: rgba(134, 239, 172, 0.32);
    color: #bbf7d0;
}

body.dark-theme .mode-switch-btn.active {
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    color: #ffffff;
    border-color: transparent;
}

@media (max-width: 640px) {
    .mode-switch {
        gap: 8px;
    }

    .mode-switch-btn {
        padding: 11px 6px;
        font-size: 12px;
        letter-spacing: -0.01em;
    }
}

.mode-hint {
    display: none !important;
}

#timer-settings-block.hidden {
    display: none;
}

.row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    width: 100%;
    align-items: stretch;
}

.row > * {
    flex: 1 1 0;
    min-width: 0;
    box-sizing: border-box;
}

input, select {
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    flex: 1 1 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    color: #111827; /* Черный текст в полях ввода */
    background: #fff;
}

.row.range-row input {
    flex: 1 1 calc(50% - 5px);
    max-width: calc(50% - 5px);
}

@media (max-width: 480px) {
    .row {
        gap: 8px;
    }

    .row.range-row input {
        flex-basis: calc(50% - 4px);
        max-width: calc(50% - 4px);
    }
}

.muted {
    font-size: 13px;
    text-align: center;
    color: #6b7280;
}

.author {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    line-height: 1;
    opacity: 0.5;
    white-space: nowrap;
    pointer-events: none;
}
/* ===== HISTORY BUTTON ===== */
.history-toggle {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 1000;
    padding: 9px 14px;
    border: none;
    border-radius: 999px;
    background: rgba(255,255,255,0.9);
    color: #111827;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(0,0,0,0.16);
    backdrop-filter: blur(10px);
}

/* ===== HISTORY MODAL ===== */
.history-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1705;
}

.history-modal.hidden,
.history-details.hidden {
    display: none;
}

.history-panel {
    width: min(960px, 100%);
    max-height: 88vh;
    overflow: auto;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.25);
    padding: 18px;
    color: #111827;
}

.history-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.history-title {
    font-size: 22px;
    font-weight: 800;
}

.history-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

.history-close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #eef2ff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #3730a3;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}


.news-panel {
    width: min(860px, 100%);
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.news-card {
    border: 1px solid rgba(99, 102, 241, 0.16);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    padding: 14px;
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.08);
}

.news-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.news-date,
.news-type {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 800;
}

.news-date {
    background: #eef2ff;
    color: #4338ca;
}

.news-type {
    background: #f3f4f6;
    color: #374151;
}

.news-title {
    font-size: 16px;
    font-weight: 900;
    color: #111827;
    margin-bottom: 8px;
}

.news-details {
    margin: 0;
    padding-left: 18px;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.45;
}

.news-details li + li {
    margin-top: 4px;
}



.stats-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stats-panel {
    width: min(1080px, 100%);
}

.stats-highlight-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.stats-hero-card {
    grid-column: span 2;
    background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 52%, #818cf8 100%);
    border: 1px solid rgba(129, 140, 248, 0.35);
    border-radius: 22px;
    padding: 18px;
    color: #ffffff;
    box-shadow: 0 18px 40px rgba(67, 56, 202, 0.22);
}

.stats-hero-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.03em;
    opacity: 0.88;
    margin-bottom: 10px;
}

.stats-hero-score {
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.05;
    font-weight: 900;
    word-break: break-word;
}

.stats-hero-subtitle {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.9);
}

.stats-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.stats-pill {
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #eef2ff;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(8px);
}

.stats-highlight-card {
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
    border: 1px solid #dbeafe;
    border-radius: 18px;
    padding: 14px;
    min-height: 118px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stats-highlight-card--success {
    background: linear-gradient(135deg, #ecfdf5 0%, #f8fafc 100%);
    border-color: #bbf7d0;
}

.stats-highlight-card--warm {
    background: linear-gradient(135deg, #fff7ed 0%, #fffaf5 100%);
    border-color: #fed7aa;
}

.stats-highlight-card--violet {
    background: linear-gradient(135deg, #f5f3ff 0%, #fafaff 100%);
    border-color: #ddd6fe;
}

.stats-highlight-card--dark {
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    border-color: #1f2937;
}

.stats-highlight-card--dark .stats-highlight-label,
.stats-highlight-card--dark .stats-highlight-value,
.stats-highlight-card--dark .stats-highlight-note {
    color: #f9fafb;
}

.stats-highlight-card--dark .stats-highlight-label {
    opacity: 0.75;
}

.stats-highlight-card--calm {
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border-color: #bfdbfe;
}

.stats-highlight-card--speed {
    background: linear-gradient(135deg, #fff7ed 0%, #fffaf5 100%);
    border-color: #fdba74;
}

.stats-section-speed {
    border-color: #fed7aa;
    background: linear-gradient(180deg, #fffaf5 0%, #ffffff 100%);
}

.stats-highlight-label {
    font-size: 12px;
    color: #6366f1;
    font-weight: 700;
    margin-bottom: 8px;
}

.stats-highlight-value {
    font-size: 24px;
    line-height: 1.1;
    font-weight: 900;
    color: #111827;
    word-break: break-word;
}

.stats-highlight-note {
    margin-top: 8px;
    font-size: 12px;
    color: #475569;
    line-height: 1.4;
}

.stats-section {
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 14px;
    background: #fcfcff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.stats-section-title {
    font-size: 17px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 12px;
}

.stats-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.stats-metric-item {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
}

.stats-metric-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.stats-metric-value {
    font-size: 18px;
    font-weight: 800;
    color: #111827;
    line-height: 1.25;
    word-break: break-word;
}

.stats-metric-note {
    font-size: 12px;
    color: #475569;
    margin-top: 6px;
    line-height: 1.4;
}

.history-empty {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
    padding: 22px;
    text-align: center;
    color: #475569;
}


.history-item {
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 14px;
    background: #fcfcff;
}

.history-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.history-summary {
    flex: 1;
    min-width: 0;
}

.history-id {
    font-size: 14px;
    font-weight: 800;
    color: #312e81;
    margin-bottom: 8px;
    word-break: break-word;
}

.history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: #374151;
    font-size: 13px;
}

.history-meta span {
    background: #f3f4f6;
    border-radius: 999px;
    padding: 6px 10px;
}

.history-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.history-actions button {
    border: none;
    border-radius: 12px;
    padding: 10px 12px;
    background: #6366f1;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

.history-actions button.danger {
    background: #ef4444;
}

.history-details {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
}

.history-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
    font-size: 14px;
}

.cheat-log {
    background: #fff7ed;
    border: 1px solid #fdba74;
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 14px;
}

.cheat-log.clean {
    background: #ecfdf5;
    border-color: #86efac;
    color: #166534;
}

.cheat-log-title {
    font-weight: 800;
    margin-bottom: 8px;
}

.cheat-log-item {
    font-size: 14px;
    margin-bottom: 6px;
}

.answers-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.answer-card {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 12px;
    background: #ffffff;
}

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

.answer-number {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 800;
}

.answer-status {
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 800;
}

.answer-status.ok {
    background: #dcfce7;
    color: #166534;
}

.answer-status.bad {
    background: #fee2e2;
    color: #991b1b;
}

.answer-status.timeout {
    background: #fef3c7;
    color: #92400e;
}

.answer-question {
    font-weight: 800;
    margin-bottom: 8px;
    text-align: left;
    color: #111827;
}

.answer-line {
    text-align: left;
    color: #374151;
    margin-bottom: 6px;
    line-height: 1.4;
}

@media (max-width: 700px) {
    .history-toggle {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 13px;
    }

    .history-item-head,
    .history-panel-header {
        flex-direction: column;
    }

    .history-actions {
        width: 100%;
        justify-content: stretch;
    }

    .history-actions button {
        flex: 1;
    }

    .history-detail-grid {
        grid-template-columns: 1fr;
    }
}


/* ===== USER AGREEMENT ===== */
body.agreement-page-locked {
    overflow: hidden;
}

.agreement-overlay {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(8px);
}

.agreement-overlay.hidden {
    display: none;
}

.agreement-panel {
    width: min(680px, 100%);
    max-height: 90vh;
    overflow: auto;
    background: #ffffff;
    border-radius: 24px;
    padding: 22px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.28);
    color: #111827;
}

.agreement-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 10px;
}

.agreement-title {
    margin: 0 0 10px;
}

.agreement-lead {
    margin: 0 0 14px;
    color: #374151;
    line-height: 1.5;
}

.agreement-short {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 14px;
    line-height: 1.6;
    margin-bottom: 14px;
}

.agreement-text {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 16px;
    line-height: 1.6;
    text-align: left;
    margin-bottom: 14px;
}

.agreement-text.hidden {
    display: none;
}

.agreement-text ol {
    padding-left: 20px;
    margin: 10px 0 0;
}

.agreement-text li + li {
    margin-top: 8px;
}

.agreement-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

button.main.secondary {
    background: #e5e7eb;
    color: #111827;
}

button.main.danger {
    background: #ef4444;
    color: #ffffff;
}

button.main.danger:disabled {
    background: #fca5a5;
    cursor: not-allowed;
}

.agreement-status {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    line-height: 1.5;
}

.agreement-status.hidden {
    display: none;
}


.agreement-doc-title {
    margin: 0 0 12px;
    font-size: 20px;
    line-height: 1.35;
    color: #111827;
}

.agreement-doc-meta {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #f8fafc;
    color: #374151;
    font-size: 14px;
    line-height: 1.6;
}

.agreement-doc-section {
    margin: 18px 0 10px;
    font-size: 16px;
    line-height: 1.4;
    color: #312e81;
}

.agreement-doc-note {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}


#history-toggle {
    top: 60px;
}

.study-toggle {
    top: 14px;
    right: 14px;
    padding: 8px 12px;
    font-size: 13px;
}

.study-panel {
    width: min(980px, 100%);
}


.study-sticky-search {
    position: sticky;
    top: 0;
    z-index: 18;
    margin: 0 -18px 12px;
    padding: 10px 18px 10px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid rgba(229, 231, 235, 0.9);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: visible;
}

.study-search-wrap {
    margin: 0;
}

.study-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    font: inherit;
}

.study-search-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.study-search-meta {
    margin: 7px 2px 0;
    font-size: 13px;
    color: #6b7280;
}

.study-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.study-card {
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 14px;
    background: #f8fafc;
}

.study-question-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.study-question-text {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.45;
    color: #111827;
}

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

.generated-options-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    margin: -2px 0 10px 46px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.10);
    color: #4338ca;
    border: 1px solid rgba(99, 102, 241, 0.18);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.25;
}

@media (max-width: 640px) {
    .generated-options-badge {
        margin-left: 40px;
        font-size: 10.5px;
    }
}

.study-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 11px 12px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #111827;
    line-height: 1.4;
}

.study-option.correct {
    background: #dcfce7;
    border-color: #22c55e;
    color: #166534;
    font-weight: 700;
}

.study-option-letter {
    min-width: 22px;
    font-weight: 800;
}

.study-error {
    margin-top: 8px;
    color: #991b1b;
}

.study-retry {
    max-width: 220px;
    margin: 14px auto 0;
}

@media (max-width: 640px) {
    #history-toggle {
        top: 56px;
    }

    .study-sticky-search {
        top: 0;
        margin: 0 -14px 10px;
        padding: 9px 14px 9px;
    }

    .study-toggle,
    #history-toggle {
        right: 10px;
        padding: 8px 10px;
        font-size: 12px;
    }

    .study-question-text {
        font-size: 15px;
    }
}

/* ===== APP DRAWER MENU ===== */
body.app-menu-open,
body.history-modal-open,
body.stats-modal-open,
body.study-modal-open,
body.agreement-page-locked,
body.app-surface-open {
    overflow: hidden;
}

body.app-menu-open .app-menu-toggle,
body.history-modal-open .app-menu-toggle,
body.stats-modal-open .app-menu-toggle,
body.news-modal-open .app-menu-toggle,
body.study-modal-open .app-menu-toggle,
body.agreement-page-locked .app-menu-toggle,
body.app-surface-open .app-menu-toggle {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.app-menu-toggle {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1600;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 16px;
    background: rgba(255,255,255,0.92);
    box-shadow: 0 10px 24px rgba(0,0,0,0.18);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.app-menu-toggle span {
    display: block;
    width: 22px;
    height: 2.5px;
    border-radius: 999px;
    background: #111827;
}



.app-menu-toggle-hint-target {
    animation: appMenuHintPulse 1.45s ease-in-out infinite;
    box-shadow: 0 0 0 6px rgba(124, 58, 237, 0.16), 0 16px 34px rgba(79, 70, 229, 0.28);
}

@keyframes appMenuHintPulse {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-1px) scale(1.04);
    }
}

.app-menu-hint {
    position: fixed;
    top: 76px;
    left: 16px;
    z-index: 1490;
    width: min(320px, calc(100vw - 32px));
    box-sizing: border-box;
    padding: 16px 16px 14px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    color: #111827;
    border: 1px solid rgba(99, 102, 241, 0.22);
    box-shadow: 0 22px 54px rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}





.app-menu-hint-badge {
    display: inline-flex;
    align-items: center;
    width: max-content;
    padding: 5px 10px;
    margin-bottom: 8px;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.10);
    color: #5b21b6;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.2px;
}

.app-menu-hint-title {
    font-size: 18px;
    line-height: 1.18;
    font-weight: 900;
    margin-bottom: 7px;
    color: #111827;
}

.app-menu-hint-text {
    font-size: 14px;
    line-height: 1.48;
    color: #4b5563;
    margin-bottom: 12px;
}

.app-menu-hint-button {
    width: 100%;
    border: 0;
    border-radius: 16px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 12px 26px rgba(79, 70, 229, 0.24);
}

.app-menu-hint-button:active {
    transform: translateY(1px);
}

body.dark-theme .app-menu-toggle-hint-target {
    box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.22), 0 16px 34px rgba(2, 6, 23, 0.58) !important;
}

body.dark-theme .app-menu-hint {
    background: rgba(15, 23, 42, 0.96);
    color: #f8fafc;
    border-color: rgba(139, 92, 246, 0.34);
    box-shadow: 0 24px 58px rgba(2, 6, 23, 0.62);
}


body.dark-theme .app-menu-hint-badge {
    background: rgba(139, 92, 246, 0.18);
    color: #ddd6fe;
}

body.dark-theme .app-menu-hint-title {
    color: #f8fafc;
}

body.dark-theme .app-menu-hint-text {
    color: #cbd5e1;
}

.premium-incognito-hint {
    position: fixed;
    top: 76px;
    left: 16px;
    z-index: 1495;
    width: min(330px, calc(100vw - 32px));
    box-sizing: border-box;
    padding: 16px 16px 14px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.97);
    color: #111827;
    border: 1px solid rgba(16, 185, 129, 0.22);
    box-shadow: 0 22px 54px rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.premium-incognito-hint-badge {
    display: inline-flex;
    align-items: center;
    width: max-content;
    padding: 5px 10px;
    margin-bottom: 8px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.10);
    color: #0f766e;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.2px;
}

.premium-incognito-hint-title {
    font-size: 18px;
    line-height: 1.18;
    font-weight: 900;
    margin-bottom: 7px;
    color: #111827;
}

.premium-incognito-hint-text {
    font-size: 14px;
    line-height: 1.48;
    color: #4b5563;
    margin-bottom: 12px;
}

.premium-incognito-hint-button {
    width: 100%;
    border: 0;
    border-radius: 16px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #0f766e, #0ea5a4);
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 12px 26px rgba(13, 148, 136, 0.24);
}

body.dark-theme .premium-incognito-hint {
    background: rgba(15, 23, 42, 0.96);
    color: #f8fafc;
    border-color: rgba(45, 212, 191, 0.34);
    box-shadow: 0 24px 58px rgba(2, 6, 23, 0.62);
}

body.dark-theme .premium-incognito-hint-badge {
    background: rgba(45, 212, 191, 0.16);
    color: #99f6e4;
}

body.dark-theme .premium-incognito-hint-title {
    color: #f8fafc;
}

body.dark-theme .premium-incognito-hint-text {
    color: #cbd5e1;
}

@media (max-width: 390px) {
    .app-menu-hint,
    .premium-incognito-hint {
        top: 74px;
        left: 12px;
        width: min(300px, calc(100vw - 24px));
        padding: 14px;
        border-radius: 20px;
    }

    .app-menu-hint-title,
    .premium-incognito-hint-title {
        font-size: 17px;
    }

    .app-menu-hint-text,
    .premium-incognito-hint-text {
        font-size: 13.5px;
    }
}


body.app-menu-open .app-favorites-toggle,
body.history-modal-open .app-favorites-toggle,
body.stats-modal-open .app-favorites-toggle,
body.study-modal-open .app-favorites-toggle,
body.agreement-page-locked .app-favorites-toggle,
body.app-surface-open .app-favorites-toggle,
body.app-menu-open .premium-incognito-toggle,
body.history-modal-open .premium-incognito-toggle,
body.stats-modal-open .premium-incognito-toggle,
body.study-modal-open .premium-incognito-toggle,
body.agreement-page-locked .premium-incognito-toggle,
body.app-surface-open .premium-incognito-toggle {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.app-favorites-toggle {
    position: fixed;
    top: 14px;
    left: 74px;
    z-index: 1600;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 16px;
    background: rgba(255,255,255,0.92);
    color: #f59e0b;
    font-size: 28px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 10px 24px rgba(0,0,0,0.18);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-menu-footer {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.app-menu-link-button {
    width: 100%;
    border: 1px solid rgba(99,102,241,0.35);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff, #eef2ff);
    color: #1f2937;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 700;
    text-align: left;
    box-shadow: 0 10px 24px rgba(79,70,229,0.10);
    cursor: pointer;
}

.app-menu-link-button:hover,
.app-menu-link-button:focus-visible {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}


.app-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: rgba(15, 23, 42, 0.48);
    display: flex;
    justify-content: flex-start;
}

.app-menu-overlay.hidden {
    display: none;
}

.app-drawer {
    width: min(360px, calc(100vw - 28px));
    height: 100%;
    background: #ffffff;
    box-shadow: 12px 0 32px rgba(0,0,0,0.18);
    padding: 14px 12px 14px;
    overflow: auto;
}

.app-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.app-drawer-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}


.app-drawer-title {
    font-size: 22px;
    font-weight: 800;
    color: #111827;
}

.app-drawer-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

.app-drawer-close {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 14px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.app-drawer-icon-button {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 14px;
    background: #eef2ff;
    color: #3730a3;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 22px rgba(79, 70, 229, 0.14);
}

.app-theme-toggle-icon {
    font-size: 19px;
    line-height: 1;
}

.app-menu-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.app-menu-card {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #f8fafc;
    overflow: hidden;
}

.app-menu-card.active {
    border-color: #6366f1;
    background: #eef2ff;
}

.app-menu-item {
    width: 100%;
    border: none;
    background: transparent;
    padding: 12px 12px;
    text-align: left;
    cursor: pointer;
    color: #111827;
}

.app-menu-item.active {
    background: transparent;
}

.app-menu-item.is-current {
    cursor: default;
}

.app-menu-item-standalone {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #f8fafc;
}

.app-menu-item-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.app-menu-item-label {
    font-size: 14px;
    font-weight: 800;
}

.app-menu-item-badge {
    flex-shrink: 0;
    padding: 3px 8px;
    border-radius: 999px;
    background: #6366f1;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
}

.app-menu-item-desc,
.app-menu-subitem-desc {
    display: none !important;
}

.app-menu-children {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 10px 10px;
}

.app-menu-subitem {
    width: 100%;
    border: none;
    border-radius: 13px;
    background: #ffffff;
    padding: 10px 11px;
    text-align: left;
    cursor: pointer;
    color: #111827;
    box-shadow: inset 0 0 0 1px rgba(99,102,241,0.14);
}

.app-menu-subitem-label {
    font-size: 14px;
    font-weight: 800;
}

.app-menu-standalone-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (max-width: 640px) {
    .app-menu-toggle {
        top: 10px;
        left: 10px;
        width: 46px;
        height: 46px;
        border-radius: 14px;
    }

    .app-favorites-toggle {
        top: 10px;
        left: 66px;
        width: 46px;
        height: 46px;
        border-radius: 14px;
        font-size: 24px;
    }

    .app-drawer {
        width: min(340px, calc(100vw - 20px));
        padding: 16px 12px;
    }

    .app-menu-link-button {
        padding: 13px 14px;
        font-size: 15px;
    }
}

/* ===== PAGE TRANSITION LOADER ===== */
body.page-transition-active,
body.intro-splash-active {
    overflow: hidden;
}

.page-transition-loader,
.intro-splash-loader {
    position: fixed;
    inset: 0;
    z-index: 7000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    opacity: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 25% 20%, rgba(255,255,255,.12), transparent 26%),
        radial-gradient(circle at 72% 82%, rgba(255,255,255,.08), transparent 28%),
        linear-gradient(135deg, #6b76dd, #6f4bc8 58%, #8a6fd2);
    transition: opacity 0.28s ease;
}

.page-transition-loader.visible,
.intro-splash-loader.visible {
    opacity: 1;
    pointer-events: auto;
}

.page-transition-panel {
    width: min(380px, 100%);
    padding: 28px 24px 24px;
    border-radius: 28px;
    text-align: center;
    color: #ffffff;
    background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.08));
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 30px 70px rgba(0,0,0,0.32);
}

.intro-splash-loader {
    padding: 0;
}

.intro-card-scene {
    position: relative;
    width: min(96vw, 460px);
    height: min(88vh, 760px);
    overflow: hidden;
}

.intro-splash-hint {
    position: absolute;
    left: 50%;
    bottom: max(22px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: min(92vw, 560px);
    padding: 10px 14px;
    border-radius: 18px;
    color: rgba(255,255,255,.94);
    background: rgba(18, 12, 44, .28);
    border: 1px solid rgba(255,255,255,.18);
    box-shadow: 0 12px 32px rgba(26, 16, 62, .18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: 13px;
    line-height: 1.45;
    text-align: center;
}

.intro-splash-hint span {
    font-weight: 900;
}

.intro-card,
.intro-card * {
    box-sizing: border-box;
}

.intro-card {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 390px;
    max-width: 88vw;
    border-radius: 28px;
    background: linear-gradient(180deg, #fbfbfd, #f3f3f6);
    box-shadow: 0 28px 60px rgba(38,20,89,.24), inset 0 0 0 1px rgba(65,51,115,.10);
    padding: 18px 22px 16px;
    transform: translate(-50%, -50%);
    opacity: 1;
    overflow: hidden;
    will-change: transform, opacity;
    transition: transform .78s linear, opacity .30s linear;
}

.intro-card.no-transition {
    transition: none !important;
}

.intro-card.hidden-right {
    transform: translate(calc(-50% + 430px), -50%);
    opacity: 0;
}

.intro-card.hidden-left {
    transform: translate(calc(-50% - 430px), -50%);
    opacity: 0;
}

.intro-card.center {
    transform: translate(-50%, -50%);
    opacity: 1;
}

.intro-card-name {
    font-size: 28px;
    font-weight: 900;
    color: #2b2458;
    letter-spacing: .1px;
    text-shadow: 0 1px 0 rgba(255,255,255,.65);
    text-align: center;
    width: 100%;
    margin-bottom: 4px;
}

.intro-card-name .tm {
    font-size: 12px;
    vertical-align: super;
    margin-left: 1px;
}

.intro-card-meta {
    width: 34%;
    height: 16px;
    border-radius: 999px;
    background: rgba(48,57,88,.88);
    opacity: .92;
    margin-bottom: 10px;
}

.intro-card-rule {
    height: 3px;
    border-radius: 999px;
    background: #dcdde5;
    margin-bottom: 14px;
}

.intro-card-lines {
    margin-bottom: 12px;
}

.intro-card-line {
    height: 9px;
    border-radius: 999px;
    background: #a99adf;
    opacity: .9;
    margin-bottom: 8px;
}

.intro-card-line.wide { width: 86%; }
.intro-card-line.short { width: 58%; }

.intro-card-option {
    width: calc(100% - 12px);
    margin-right: 12px;
    margin-left: 0;
    min-height: 52px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    margin-bottom: 10px;
    box-shadow: 0 1px 0 rgba(255,255,255,.55) inset;
    border: 4px solid transparent;
    background: #eceef3;
}

.intro-card-option--danger {
    background: #efd6d6;
    border-color: #dd4e4e;
}

.intro-card-option--success {
    background: #d8eedb;
    border-color: #35bf68;
}

.intro-card-option-fill {
    height: 12px;
    border-radius: 999px;
    background: #a99adf;
    opacity: .82;
}

.intro-card-option-fill.fill-1 { width: 64%; }
.intro-card-option-fill.fill-2 { width: 48%; }
.intro-card-option-fill.fill-3 { width: 48%; }
.intro-card-option-fill.fill-4 { width: 74%; }

.intro-card-nav--single { display: block; }
.intro-card-nav--double { display: flex; gap: 12px; }

.intro-card-nav-btn {
    height: 52px;
    border-radius: 22px;
    background: linear-gradient(90deg, #6367e7, #5a5fe0);
    border: 4px solid rgba(53,55,68,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 8px 18px rgba(47,37,109,.14);
    flex: 1;
}

.intro-card-nav--single .intro-card-nav-btn { width: 100%; }

.intro-card-arrow {
    width: 26px;
    height: 4px;
    border-radius: 999px;
    background: #f3ec8e;
    position: relative;
}

.intro-card-arrow.arrow-right::after {
    content: '';
    position: absolute;
    right: -2px;
    top: -4px;
    width: 10px;
    height: 10px;
    border-top: 4px solid #f3ec8e;
    border-right: 4px solid #f3ec8e;
    transform: rotate(45deg);
}

.intro-card-arrow.arrow-left::after {
    content: '';
    position: absolute;
    left: -2px;
    top: -4px;
    width: 10px;
    height: 10px;
    border-top: 4px solid #f3ec8e;
    border-left: 4px solid #f3ec8e;
    transform: rotate(-45deg);
}

.page-transition-spinner {
    position: relative;
    width: 86px;
    height: 86px;
    margin: 0 auto 18px;
}

.intro-splash-panel .page-transition-spinner {
    margin-bottom: 0;
}

.page-transition-spinner span {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: rgba(255,255,255,0.95);
    border-right-color: rgba(255,255,255,0.42);
    animation: pageTransitionSpin 1s linear infinite;
}

.page-transition-spinner span:nth-child(2) {
    inset: 10px;
    animation-duration: 1.3s;
    animation-direction: reverse;
    border-top-color: rgba(191, 219, 254, 0.95);
    border-right-color: rgba(191, 219, 254, 0.36);
}

.page-transition-spinner span:nth-child(3) {
    inset: 22px;
    animation-duration: 0.85s;
    border-top-color: rgba(255, 255, 255, 0.9);
    border-right-color: rgba(255,255,255,0.24);
}

.page-transition-title {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 8px;
}

.page-transition-subtitle {
    font-size: 15px;
    line-height: 1.55;
    color: rgba(255,255,255,0.82);
    margin-bottom: 18px;
}

.page-transition-status {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.45;
    color: rgba(255,255,255,0.95);
    margin-bottom: 16px;
}

.page-transition-status.pulse {
    animation: fade 0.35s ease;
}

.page-transition-progress {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255,255,255,0.16);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.18);
}

.page-transition-progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(255,255,255,0.92), rgba(191, 219, 254, 0.96));
}

@keyframes pageTransitionSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pageTransitionProgressFill {
    from { width: 0; }
    to { width: 100%; }
}

@media (max-width: 640px) {
    .page-transition-panel {
        padding: 24px 20px 20px;
        border-radius: 24px;
    }

    .intro-card-scene {
        width: min(96vw, 420px);
        height: min(80vh, 700px);
    }

    .intro-card {
        width: 88vw;
        padding: 16px 16px 14px;
    }

    .intro-card-name {
        font-size: 24px;
    }

    .intro-card-meta {
        height: 14px;
    }

    .intro-card-option {
        width: calc(100% - 10px);
        margin-right: 10px;
        min-height: 50px;
        margin-bottom: 8px;
    }

    .intro-card-nav-btn {
        height: 50px;
    }

    .page-transition-spinner {
        width: 78px;
        height: 78px;
        margin-bottom: 16px;
    }

    .intro-splash-panel .page-transition-spinner {
        margin-bottom: 0;
    }

    .page-transition-title {
        font-size: 20px;
    }

    .page-transition-subtitle,
    .page-transition-status {
        font-size: 14px;
    }
}



/* ===== DARK THEME ===== */
body.dark-theme {
    background: linear-gradient(135deg, #0f172a 0%, #111827 52%, #312e81 100%);
    color: #e5e7eb;
}

body.dark-theme .card,
body.dark-theme .history-panel,
body.dark-theme .study-panel,
body.dark-theme .stats-panel,
body.dark-theme .agreement-panel,
body.dark-theme .app-drawer,
body.dark-theme .study-card,
body.dark-theme .history-item,
body.dark-theme .news-card,
body.dark-theme .app-menu-card,
body.dark-theme .stats-metric-item,
body.dark-theme .app-menu-item-standalone,
body.dark-theme .page-transition-panel {
    background: linear-gradient(180deg, rgba(10, 18, 38, 0.96), rgba(15, 23, 42, 0.99)) !important;
    color: #e5e7eb !important;
    border-color: rgba(129, 140, 248, 0.2) !important;
    box-shadow: 0 22px 48px rgba(2, 6, 23, 0.54), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3,
body.dark-theme .progress,
body.dark-theme #question,
body.dark-theme .history-title,
body.dark-theme .history-subtitle,
body.dark-theme .news-title,
body.dark-theme .study-question-text,
body.dark-theme .study-search-meta,
body.dark-theme .agreement-title,
body.dark-theme .agreement-doc-title,
body.dark-theme .app-drawer-title,
body.dark-theme .app-menu-item-label,
body.dark-theme .app-menu-subitem-label,
body.dark-theme .stats-metric-value,
body.dark-theme .stats-highlight-value,
body.dark-theme .stats-highlight-label {
    color: #f8fafc !important;
}

body.dark-theme .muted,
body.dark-theme .history-meta,
body.dark-theme .history-id,
body.dark-theme .news-details,
body.dark-theme .agreement-text,
body.dark-theme .agreement-lead,
body.dark-theme .agreement-short,
body.dark-theme .agreement-doc-note,
body.dark-theme .agreement-doc-meta,
body.dark-theme .app-drawer-subtitle,
body.dark-theme .app-menu-item-desc,
body.dark-theme .app-menu-subitem-desc,
body.dark-theme .stats-highlight-note,
body.dark-theme .stats-metric-note {
    color: #cbd5e1 !important;
}

body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea,
body.dark-theme .study-search-input {
    background: rgba(30, 41, 59, 0.9) !important;
    color: #f8fafc !important;
    border-color: rgba(148, 163, 184, 0.28) !important;
}

body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder,
body.dark-theme .study-search-input::placeholder {
    color: #94a3b8 !important;
}

body.dark-theme .study-sticky-search {
    background: linear-gradient(180deg, rgba(10, 18, 38, 0.98), rgba(15, 23, 42, 0.94)) !important;
    border-bottom-color: rgba(129, 140, 248, 0.22) !important;
    box-shadow: 0 14px 28px rgba(2, 6, 23, 0.42) !important;
}

body.dark-theme button.option,
body.dark-theme .study-option,
body.dark-theme .app-menu-subitem,
body.dark-theme .app-menu-item,
body.dark-theme .app-menu-link-button {
    background: rgba(30, 41, 59, 0.9) !important;
    color: #f8fafc !important;
    border-color: rgba(148, 163, 184, 0.18) !important;
}

body.dark-theme button.option.selected,
body.dark-theme .app-menu-card.active,
body.dark-theme .app-menu-item.active,
body.dark-theme .app-menu-item.is-current,
body.dark-theme .app-menu-subitem:hover {
    background: rgba(49, 46, 129, 0.72) !important;
    border-color: rgba(129, 140, 248, 0.44) !important;
}

body.dark-theme button.option.correct,
body.dark-theme .study-option.correct {
    background: rgba(20, 83, 45, 0.8) !important;
    color: #dcfce7 !important;
    border-color: rgba(74, 222, 128, 0.5) !important;
}

body.dark-theme .generated-options-badge {
    background: rgba(129, 140, 248, 0.16) !important;
    color: #c7d2fe !important;
    border-color: rgba(129, 140, 248, 0.30) !important;
}

body.dark-theme button.option.wrong {
    background: rgba(127, 29, 29, 0.8) !important;
    color: #fee2e2 !important;
    border-color: rgba(248, 113, 113, 0.5) !important;
}

body.dark-theme #timer,
body.dark-theme .timer-speed-label,
body.dark-theme .timer-speed-value,
body.dark-theme .speed-mode-badge {
    color: #c4b5fd !important;
}

body.dark-theme .app-menu-overlay,
body.dark-theme .history-modal,
body.dark-theme .agreement-overlay {
    background: rgba(2, 6, 23, 0.72) !important;
}

body.dark-theme .app-drawer-close,
body.dark-theme .app-drawer-icon-button,
body.dark-theme .app-menu-toggle,
body.dark-theme .app-favorites-toggle,
body.dark-theme .premium-incognito-toggle {
    background: rgba(15, 23, 42, 0.9) !important;
    color: #e5e7eb !important;
    box-shadow: 0 14px 28px rgba(2, 6, 23, 0.5) !important;
}

body.dark-theme .app-menu-toggle span {
    background: #f8fafc !important;
}

body.dark-theme .app-menu-item-badge,
body.dark-theme button.main,
body.dark-theme .top-finish-btn {
    background: linear-gradient(135deg, #4338ca 0%, #7c3aed 100%) !important;
    color: #ffffff !important;
}

body.dark-theme .favorite-question-btn,
body.dark-theme .study-favorite-btn {
    background: rgba(30, 41, 59, 0.95) !important;
    color: #f8fafc !important;
    border-color: rgba(129, 140, 248, 0.26) !important;
}

body.dark-theme .favorite-question-btn.is-active,
body.dark-theme .study-favorite-btn.is-active,
body.dark-theme .app-favorites-toggle.is-active,
body.dark-theme .app-favorites-toggle:hover {
    background: linear-gradient(135deg, #78350f 0%, #b45309 100%) !important;
    color: #fef3c7 !important;
    border-color: rgba(251, 191, 36, 0.45) !important;
}


body.dark-theme .history-meta span {
    background: rgba(30, 41, 59, 0.98) !important;
    color: #f8fafc !important;
    border: 1px solid rgba(148, 163, 184, 0.22) !important;
}

body.dark-theme .history-empty,
body.dark-theme .cheat-log,
body.dark-theme .cheat-log.clean,
body.dark-theme .history-details {
    background: rgba(15, 23, 42, 0.96) !important;
    color: #e5e7eb !important;
    border-color: rgba(148, 163, 184, 0.18) !important;
}

body.dark-theme .history-actions button {
    box-shadow: 0 10px 20px rgba(2, 6, 23, 0.35) !important;
}

body.dark-theme .stats-hero-subtitle,
body.dark-theme .stats-pill {
    color: #eef2ff !important;
}

body.dark-theme .stats-highlight-card,
body.dark-theme .stats-highlight-card--success,
body.dark-theme .stats-highlight-card--warm,
body.dark-theme .stats-highlight-card--violet,
body.dark-theme .stats-highlight-card--calm,
body.dark-theme .stats-highlight-card--speed {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.98)) !important;
    border-color: rgba(129, 140, 248, 0.2) !important;
    box-shadow: 0 18px 30px rgba(2, 6, 23, 0.28), inset 0 1px 0 rgba(255,255,255,0.03) !important;
}

body.dark-theme .stats-highlight-card--dark {
    background: linear-gradient(135deg, #0f172a 0%, #111827 100%) !important;
    border-color: rgba(129, 140, 248, 0.18) !important;
}

body.dark-theme .stats-highlight-label,
body.dark-theme .stats-highlight-value,
body.dark-theme .stats-highlight-note,
body.dark-theme .stats-section-title,
body.dark-theme .stats-hero-title,
body.dark-theme .stats-hero-score,
body.dark-theme .stats-metric-label,
body.dark-theme .stats-metric-value,
body.dark-theme .stats-metric-note {
    color: #f8fafc !important;
}

body.dark-theme .stats-highlight-label,
body.dark-theme .stats-metric-label,
body.dark-theme .stats-hero-title {
    opacity: 0.88;
}

body.dark-theme .stats-highlight-note,
body.dark-theme .stats-metric-note {
    color: #cbd5e1 !important;
}

body.dark-theme .stats-section,
body.dark-theme .stats-section-speed,
body.dark-theme .stats-metric-item {
    background: linear-gradient(180deg, rgba(10, 18, 38, 0.96), rgba(15, 23, 42, 0.99)) !important;
    border-color: rgba(129, 140, 248, 0.18) !important;
}

/* ===== SUBSCRIPTION PURCHASE MODAL ===== */
.subscription-menu-link {
    position: relative;
    overflow: hidden;
}

.subscription-menu-link::before {
    content: "👑";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 8px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    vertical-align: -2px;
}

.subscription-panel {
    position: relative;
    width: min(720px, 100%);
}

.subscription-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.92);
    color: #111827;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}


.subscription-free-period {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 14px 0;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid rgba(99, 102, 241, 0.24);
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    color: #312e81;
    font-weight: 850;
}

.subscription-free-period strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 86px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #ffffff;
    color: #4c1d95;
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.12);
}

.subscription-plans {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0;
}

.subscription-plan-card {
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 18px;
    padding: 14px;
    background: linear-gradient(180deg, #f8fafc, #eef2ff);
}

.subscription-plan-title {
    font-weight: 900;
    color: #312e81;
    margin-bottom: 6px;
}

.subscription-plan-desc {
    font-size: 13px;
    line-height: 1.45;
    color: #475569;
}

.subscription-plan-price-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 0 0 8px;
}

.subscription-plan-price {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    margin: 0;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.12);
    color: #4c1d95;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.01em;
}

.subscription-plan-price-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.subscription-plan-old-price {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
}

.subscription-plan-discount-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.1);
    color: #4338ca;
    font-size: 12px;
    font-weight: 900;
}

.subscription-payment-card {
    margin: 14px 0;
    padding: 16px;
    border-radius: 20px;
    border: 1px solid rgba(99, 102, 241, 0.22);
    background: #0f172a;
    color: #f8fafc;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
}

.subscription-payment-label {
    font-size: 13px;
    color: #c7d2fe;
    margin-bottom: 8px;
    font-weight: 800;
}

.subscription-card-number {
    font-size: clamp(22px, 5vw, 34px);
    font-weight: 900;
    letter-spacing: 1.5px;
    line-height: 1.2;
    word-break: break-word;
}

.subscription-card-holder {
    margin-top: 8px;
    font-size: 14px;
    color: #cbd5e1;
}

.subscription-note {
    padding: 12px 14px;
    border-radius: 16px;
    background: #fff7ed;
    color: #7c2d12;
    border: 1px solid #fed7aa;
    line-height: 1.5;
    margin-bottom: 14px;
}

.subscription-actions .main {
    flex: 1 1 220px;
}

.subscription-status {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    font-weight: 700;
    line-height: 1.45;
}

.subscription-status.hidden {
    display: none;
}

.subscription-status.is-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.subscription-status.is-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}


body.dark-theme .subscription-free-period {
    background: linear-gradient(135deg, rgba(49, 46, 129, 0.58), rgba(88, 28, 135, 0.46));
    color: #ddd6fe;
    border-color: rgba(167, 139, 250, 0.28);
}

body.dark-theme .subscription-free-period strong {
    background: rgba(15, 23, 42, 0.72);
    color: #f5f3ff;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

body.dark-theme .subscription-close {
    background: rgba(30, 41, 59, 0.92);
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.24);
}

body.dark-theme .subscription-plan-card {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(129, 140, 248, 0.26);
}

body.dark-theme .subscription-plan-title {
    color: #c4b5fd;
}

body.dark-theme .subscription-plan-price {
    background: rgba(129, 140, 248, 0.18);
    color: #ede9fe;
}

body.dark-theme .subscription-plan-old-price {
    color: #cbd5e1;
}

body.dark-theme .subscription-plan-discount-badge {
    background: rgba(129, 140, 248, 0.16);
    color: #ede9fe;
}

body.dark-theme .subscription-plan-desc {
    color: #cbd5e1;
}

body.dark-theme .subscription-note {
    background: rgba(120, 53, 15, 0.35);
    color: #fed7aa;
    border-color: rgba(251, 146, 60, 0.28);
}

body.dark-theme .subscription-status.is-success {
    background: rgba(20, 83, 45, 0.75);
    color: #dcfce7;
    border-color: rgba(74, 222, 128, 0.38);
}

body.dark-theme .subscription-status.is-error {
    background: rgba(127, 29, 29, 0.75);
    color: #fee2e2;
    border-color: rgba(248, 113, 113, 0.38);
}

@media (max-width: 640px) {
    .subscription-free-period {
        align-items: flex-start;
        flex-direction: column;
    }

    .subscription-free-period strong {
        width: 100%;
    }

    .subscription-plans {
        grid-template-columns: 1fr;
    }

    .subscription-panel {
        padding-top: 24px;
    }
}

/* ===== SUBSCRIPTION PURCHASE MODAL POLISH ===== */
.subscription-front-note {
    margin: -4px 0 14px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.16);
    color: #475569;
    font-size: 14px;
    line-height: 1.55;
}

.subscription-panel .agreement-title {
    margin-top: 10px;
    margin-bottom: 12px;
    line-height: 1.15;
}

.subscription-panel .agreement-lead {
    margin-bottom: 14px;
    color: #374151;
}

.subscription-payment-card {
    background: linear-gradient(135deg, #0f172a, #111827 62%, #312e81);
}

.subscription-note {
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    border-color: rgba(99, 102, 241, 0.16);
    color: #334155;
    font-weight: 650;
}

body.dark-theme .subscription-front-note {
    background: rgba(49, 46, 129, 0.34);
    border-color: rgba(129, 140, 248, 0.24);
    color: #cbd5e1;
}

body.dark-theme .subscription-panel .agreement-lead {
    color: #d1d5db;
}

body.dark-theme .subscription-note {
    background: rgba(30, 41, 59, 0.82);
    border-color: rgba(129, 140, 248, 0.24);
    color: #e5e7eb;
}

@media (max-width: 640px) {
    .subscription-panel {
        width: min(100%, 94vw);
        padding: 22px 20px 20px;
        border-radius: 26px;
    }

    .subscription-panel .agreement-title {
        font-size: clamp(26px, 8vw, 34px);
        padding-right: 44px;
    }

    .subscription-panel .agreement-lead {
        font-size: 15px;
        line-height: 1.55;
    }

    .subscription-front-note {
        font-size: 13px;
    }

    .subscription-payment-card {
        padding: 16px 14px;
    }

    .subscription-card-number {
        font-size: clamp(21px, 7vw, 30px);
        letter-spacing: 1px;
    }
}


/* ===== SUBSCRIPTION PURCHASE MODAL FINAL CLEANUP ===== */
.subscription-panel {
    max-height: calc(100vh - 34px);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(99, 102, 241, 0.16);
}

.subscription-panel .agreement-title {
    text-align: left;
    padding-right: 52px;
    font-size: clamp(26px, 5.8vw, 34px);
}

.subscription-panel .agreement-lead {
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(99, 102, 241, 0.07);
    border: 1px solid rgba(99, 102, 241, 0.16);
    font-size: 15px;
    line-height: 1.55;
}

.subscription-plans {
    gap: 8px;
}

.subscription-plan-card {
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

.subscription-payment-card {
    margin-top: 12px;
}

.subscription-note {
    text-align: center;
    font-size: 14px;
}

body.dark-theme .subscription-panel {
    background: linear-gradient(180deg, rgba(10, 18, 38, 0.98), rgba(15, 23, 42, 0.99)) !important;
}

body.dark-theme .subscription-panel .agreement-lead {
    background: rgba(49, 46, 129, 0.34);
    border-color: rgba(129, 140, 248, 0.24);
    color: #e5e7eb;
}

@media (max-width: 640px) {
    .subscription-overlay {
        padding: 14px;
    }

    .subscription-panel {
        width: min(100%, 96vw);
        padding: 20px 18px 18px;
        border-radius: 24px;
    }

    .subscription-close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
    }

    .subscription-panel .agreement-title {
        font-size: clamp(24px, 7vw, 31px);
        line-height: 1.18;
    }

    .subscription-panel .agreement-lead {
        font-size: 14px;
    }

    .subscription-card-number {
        font-size: clamp(22px, 7vw, 29px);
        letter-spacing: 0.9px;
    }
}


/* ===== SUBSCRIPTION MODAL MOBILE FIT FIX ===== */
.subscription-overlay {
    align-items: flex-start !important;
    justify-content: center !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 12px 10px 20px !important;
}

.subscription-panel {
    width: min(680px, calc(100vw - 20px)) !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 auto 18px !important;
    padding: 18px 16px 16px !important;
    border-radius: 22px !important;
}

.subscription-close {
    position: sticky !important;
    top: 8px !important;
    z-index: 8 !important;
    float: right;
    margin: -4px -4px 4px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.16);
}

.subscription-panel .agreement-badge {
    margin-top: 0;
    margin-bottom: 8px;
}

.subscription-panel .agreement-title {
    clear: none;
    margin: 6px 0 10px !important;
    padding-right: 48px !important;
    font-size: clamp(23px, 6vw, 30px) !important;
    line-height: 1.14 !important;
}

.subscription-panel .agreement-lead {
    margin: 0 0 10px !important;
    padding: 10px 12px !important;
    border-radius: 16px !important;
    font-size: 14px !important;
    line-height: 1.45 !important;
}

.subscription-plans {
    gap: 8px !important;
    margin: 10px 0 !important;
}

.subscription-plan-card {
    padding: 11px 12px !important;
    border-radius: 16px !important;
}

.subscription-plan-title {
    margin-bottom: 5px !important;
    font-size: 16px !important;
}

.subscription-plan-price-wrap {
    gap: 5px !important;
    margin-bottom: 6px !important;
}

.subscription-plan-price {
    margin: 0 !important;
    padding: 5px 10px !important;
    font-size: 13px !important;
}

.subscription-plan-price-meta {
    gap: 5px !important;
}

.subscription-plan-old-price,
.subscription-plan-discount-badge {
    font-size: 11px !important;
}

.subscription-plan-desc {
    font-size: 13px !important;
    line-height: 1.35 !important;
}

.subscription-payment-card {
    margin: 10px 0 !important;
    padding: 13px 14px !important;
    border-radius: 18px !important;
}

.subscription-payment-label {
    margin-bottom: 6px !important;
}

.subscription-card-number {
    font-size: clamp(23px, 6vw, 32px) !important;
    letter-spacing: 1px !important;
}

.subscription-card-holder {
    margin-top: 6px !important;
    font-size: 13px !important;
}

.subscription-note {
    margin: 10px 0 10px !important;
    padding: 10px 12px !important;
    border-radius: 15px !important;
    font-size: 13px !important;
    line-height: 1.42 !important;
    text-align: left !important;
}

.subscription-actions {
    gap: 8px !important;
}

.subscription-actions .main {
    min-height: 44px !important;
    padding: 11px 12px !important;
    border-radius: 15px !important;
    font-size: 14px !important;
}

.subscription-bottom-close {
    background: rgba(15, 23, 42, 0.06) !important;
    color: #334155 !important;
}

body.dark-theme .subscription-bottom-close {
    background: rgba(148, 163, 184, 0.12) !important;
    color: #e5e7eb !important;
}

@media (max-width: 640px) {
    .subscription-overlay {
        padding-top: 8px !important;
    }

    .subscription-panel {
        width: calc(100vw - 16px) !important;
        padding: 15px 14px 14px !important;
        border-radius: 20px !important;
    }

    .subscription-close {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        font-size: 28px !important;
    }

    .subscription-panel .agreement-title {
        font-size: clamp(22px, 6.3vw, 28px) !important;
        padding-right: 46px !important;
    }

    .subscription-plans {
        grid-template-columns: 1fr !important;
    }

    .subscription-plan-card {
        display: grid;
        grid-template-columns: 1fr auto;
        column-gap: 8px;
        align-items: center;
    }

    .subscription-plan-title {
        margin: 0 !important;
    }

    .subscription-plan-price-wrap {
        grid-column: 2;
        grid-row: 1;
        align-items: flex-end;
        margin: 0 !important;
    }

    .subscription-plan-price {
        margin: 0 !important;
        white-space: nowrap;
    }

    .subscription-plan-price-meta {
        justify-content: flex-end;
    }

    .subscription-plan-desc {
        grid-column: 1 / -1;
        margin-top: 6px;
    }

    .subscription-card-number {
        font-size: clamp(22px, 6.2vw, 28px) !important;
        letter-spacing: 0.7px !important;
    }

    .subscription-actions .main {
        flex: 1 1 100% !important;
    }
}

/* ===== PREMIUM ACTIVATION MODAL ===== */
.subscription-panel .premium-key-input {
    width: 100%;
    min-height: 48px;
    padding: 13px 14px;
    border-radius: 15px;
    border: 1px solid rgba(148, 163, 184, 0.42);
    background: #ffffff;
    color: #111827;
    font-size: 14px;
    font-weight: 700;
    outline: none;
    box-sizing: border-box;
    margin: 8px 0 10px;
}

.subscription-panel .premium-key-input:focus {
    border-color: rgba(79, 70, 229, 0.48);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.subscription-panel .premium-note {
    margin: 8px 0 10px;
    padding: 9px 11px;
    border-radius: 14px;
    background: rgba(79, 70, 229, 0.07);
    color: #4b5563;
    font-size: 13px;
    line-height: 1.42;
    text-align: left;
}

.subscription-panel .premium-note.error {
    background: rgba(239, 68, 68, 0.09);
    color: #b91c1c;
}

.subscription-panel .premium-note.success {
    background: rgba(34, 197, 94, 0.10);
    color: #166534;
}

body.dark-theme .subscription-panel .premium-key-input {
    background: rgba(15, 23, 42, 0.78);
    border-color: rgba(148, 163, 184, 0.30);
    color: #f8fafc;
}

body.dark-theme .subscription-panel .premium-note {
    background: rgba(129, 140, 248, 0.14);
    color: #cbd5e1;
}

body.dark-theme .subscription-panel .premium-note.error {
    background: rgba(239, 68, 68, 0.14);
    color: #fecaca;
}

body.dark-theme .subscription-panel .premium-note.success {
    background: rgba(34, 197, 94, 0.14);
    color: #bbf7d0;
}

#quiz-user-name-badge.temporary-user .quiz-user-name-badge-action,
#quiz-user-name-badge.temporary-user .quiz-user-name-badge-sticker-panel,
#quiz-user-name-badge .quiz-user-name-badge-action.hidden {
    display: none !important;
}

#quiz-user-name-badge.premium-user .quiz-user-name-badge-subtitle {
    color: #7c3aed;
    font-weight: 700;
}

body.dark-theme #quiz-user-name-badge.premium-user .quiz-user-name-badge-subtitle {
    color: #c4b5fd;
}

body.dark-theme .premium-incognito-toggle.is-active {
    background: linear-gradient(135deg, #0f172a 0%, #155e75 100%) !important;
    color: #ecfeff !important;
}



/* ===== ANTI COPY (ТЕСТЫ / ИЗУЧИТЬ ТЕСТЫ / ИСТОРИЯ / ИЗБРАННОЕ) ===== */
.quiz-test-page .card,
.quiz-test-page .card *,
#question,
#question *,
#options,
#options *,
#study-list,
#study-list *,
.study-list,
.study-list *,
#favorites-list,
#favorites-list *,
#history-list,
#history-list *,
.history-details,
.history-details *,
.answers-list,
.answers-list *,
.answer-card,
.answer-card *,
.answer-question,
.answer-question *,
.answer-line,
.answer-line * {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}



.theme-helper-note {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 12px;
    line-height: 1.5;
    color: #4b5563;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.12);
}

.theme-helper-note.hidden {
    display: none;
}

.retention-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 8px auto 10px;
    width: min(92vw, 420px);
}

.main-retention-strip {
    position: relative;
    z-index: 4;
    margin-top: 4px;
    margin-bottom: 12px;
    justify-content: center;
}

.retention-pill {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 30px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.12);
    color: #312e81;
    text-align: center;
    white-space: nowrap;
}

.retention-pill span {
    font-size: 13px;
    line-height: 1;
}

.retention-pill b {
    font-size: 13px;
    line-height: 1;
}

.retention-pill small {
    font-size: 9px;
    opacity: 0.82;
}

.section-progress-card {
    margin-top: 8px;
}

.achievements-panel {
    width: min(1080px, 100%);
}

.achievements-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.achievements-summary-card {
    background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 55%, #818cf8 100%);
    border: 1px solid rgba(129, 140, 248, 0.35);
    border-radius: 22px;
    padding: 18px;
    color: #ffffff;
    box-shadow: 0 18px 40px rgba(67, 56, 202, 0.22);
}

.achievements-summary-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.achievements-summary-label {
    font-size: 13px;
    font-weight: 700;
    opacity: 0.9;
    margin-bottom: 6px;
}

.achievements-summary-value {
    font-size: clamp(26px, 4vw, 38px);
    line-height: 1.05;
    font-weight: 900;
}

.achievements-summary-percent {
    font-size: 24px;
    font-weight: 900;
    white-space: nowrap;
}

.achievements-progress-track {
    margin-top: 12px;
    background: rgba(255, 255, 255, 0.18);
}

.achievements-progress-track .section-progress-fill {
    background: linear-gradient(90deg, #fff 0%, #e9d5ff 100%);
}

.achievements-summary-note {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.92);
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}


.section-progress-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.22);
    position: relative;
}

.section-progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6d5cff, #8b5cf6);
    box-shadow: 0 6px 16px rgba(109, 92, 255, 0.25);
}

.achievement-inline-track {
    margin-top: 8px;
    height: 8px;
    background: rgba(99, 102, 241, 0.12);
}

.achievement-card-progress-meta {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.45;
    color: #5b6475;
    font-weight: 700;
}

.achievement-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(99, 102, 241, 0.12);
    background: rgba(99, 102, 241, 0.05);
}

.achievement-card.unlocked {
    background: linear-gradient(180deg, rgba(236, 253, 245, 0.95), rgba(220, 252, 231, 0.95));
    border-color: rgba(34, 197, 94, 0.25);
}

.achievement-card.locked {
    opacity: 0.88;
}

.achievement-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: rgba(99, 102, 241, 0.14);
    flex: 0 0 42px;
}

.achievement-card-body {
    min-width: 0;
    flex: 1;
}

.achievement-card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.achievement-card-title {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.3;
    color: #111827;
}

.achievement-card-state {
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    background: rgba(99, 102, 241, 0.12);
    color: #4338ca;
}

.achievement-card.unlocked .achievement-card-state {
    background: rgba(34, 197, 94, 0.16);
    color: #166534;
}

.achievement-card-desc {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.5;
    color: #4b5563;
}

.section-progress-head,
.result-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 7px;
    font-size: 12px;
    font-weight: 700;
    color: #4b5563;
}

.section-progress-percent {
    color: #4338ca;
    font-weight: 800;
}

.section-progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.22);
    position: relative;
}

.section-progress-bar.large {
    height: 12px;
}

.section-progress-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6d5cff, #8b5cf6);
    box-shadow: 0 6px 16px rgba(109, 92, 255, 0.25);
}

.section-progress-meta,
.result-progress-meta {
    margin-top: 7px;
    font-size: 12px;
    line-height: 1.45;
    color: #6b7280;
}

.result-shell {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.result-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.result-title {
    font-size: 24px;
    font-weight: 900;
    color: #111827;
}

.result-subtitle {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.55;
    color: #6b7280;
}

.result-score-circle {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: linear-gradient(135deg, #6d5cff, #8b5cf6);
    color: #fff;
    font-size: 24px;
    font-weight: 900;
    box-shadow: 0 18px 35px rgba(109, 92, 255, 0.28);
}

.result-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.result-status-chip {
    padding: 8px 11px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.09);
    color: #312e81;
    font-size: 12px;
    font-weight: 800;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.result-metric {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}

.result-metric span {
    font-size: 18px;
    line-height: 1;
}

.result-metric b {
    display: block;
    color: #111827;
    font-size: 15px;
    font-weight: 900;
}

.result-metric small {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.45;
    color: #6b7280;
}

.result-progress-block,
.result-achievements {
    padding: 14px;
    border-radius: 18px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}

.result-note {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(99, 102, 241, 0.07);
    color: #374151;
    border: 1px solid rgba(99, 102, 241, 0.12);
    line-height: 1.5;
    font-size: 13px;
}

.result-achievements-title {
    font-size: 14px;
    font-weight: 900;
    color: #111827;
    margin-bottom: 10px;
}

.result-achievements-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-achievement-chip {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(99, 102, 241, 0.12);
}

.result-achievement-chip span {
    font-size: 18px;
    line-height: 1;
}

.result-achievement-chip b {
    display: block;
    font-size: 13px;
    color: #111827;
}

.result-achievement-chip small {
    display: block;
    margin-top: 3px;
    color: #6b7280;
    font-size: 11px;
    line-height: 1.45;
}

.result-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 640px) {
    .result-grid,
    .achievements-grid {
        grid-template-columns: 1fr;
    }

    .retention-strip {
        gap: 6px;
        margin: 6px auto 8px;
    }

    .retention-pill {
        min-height: 28px;
        padding: 4px 8px;
        border-radius: 999px;
    }

    .retention-pill span {
        font-size: 12px;
    }

    .retention-pill b {
        font-size: 13px;
    }

    .retention-pill small {
        font-size: 9px;
    }

    .achievements-summary-card {
        padding: 15px;
    }

    .achievements-summary-percent {
        font-size: 20px;
    }

    .achievement-card {
        padding: 12px;
    }

    .result-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .result-score-circle {
        width: 78px;
        height: 78px;
        font-size: 22px;
    }
}

body.dark-theme .theme-helper-note,
body.dark-theme .retention-pill,
body.dark-theme .result-note,
body.dark-theme .result-status-chip {
    background: rgba(49, 46, 129, 0.35) !important;
    border-color: rgba(129, 140, 248, 0.22) !important;
    color: #e5e7eb !important;
}

body.dark-theme .section-progress-meta,
body.dark-theme .section-progress-head,
body.dark-theme .result-progress-meta,
body.dark-theme .result-subtitle,
body.dark-theme .result-metric small,
body.dark-theme .result-achievement-chip small {
    color: #cbd5e1 !important;
}

body.dark-theme .result-title,
body.dark-theme .result-achievements-title,
body.dark-theme .result-metric b,
body.dark-theme .result-achievement-chip b {
    color: #f8fafc !important;
}

body.dark-theme .result-metric,
body.dark-theme .result-progress-block,
body.dark-theme .result-achievements,
body.dark-theme .result-achievement-chip,
body.dark-theme .achievement-card,
body.dark-theme .achievement-card-icon {
    background: linear-gradient(180deg, rgba(10, 18, 38, 0.96), rgba(15, 23, 42, 0.99)) !important;
    border-color: rgba(129, 140, 248, 0.2) !important;
}

body.dark-theme .achievement-card.unlocked {
    background: linear-gradient(180deg, rgba(6, 78, 59, 0.92), rgba(6, 95, 70, 0.92)) !important;
    border-color: rgba(74, 222, 128, 0.22) !important;
}

body.dark-theme .achievement-card-title,
body.dark-theme .achievement-card-state,
body.dark-theme .achievement-card-desc,
body.dark-theme .achievements-summary-note,
body.dark-theme .achievements-summary-label,
body.dark-theme .achievements-summary-value,
body.dark-theme .achievements-summary-percent {
    color: #f8fafc !important;
}

body.dark-theme .achievement-card.locked .achievement-card-desc {
    color: #cbd5e1 !important;
}

body.dark-theme .achievement-card.locked .achievement-card-state {
    background: rgba(129, 140, 248, 0.16) !important;
    color: #e0e7ff !important;
}

body.dark-theme .achievement-card.unlocked .achievement-card-state {
    background: rgba(74, 222, 128, 0.16) !important;
    color: #dcfce7 !important;
}

.section-progress-head {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    margin-bottom:6px;
}
.section-progress-label, .section-progress-percent {
    font-size:12px;
    font-weight:800;
}
.section-progress-bar {
    height:10px;
    border-radius:999px;
    background:rgba(148,163,184,.24);
    overflow:hidden;
}
.section-progress-bar span {
    display:block;
    height:100%;
    border-radius:inherit;
    background:linear-gradient(135deg,#6366f1 0%, #8b5cf6 100%);
}
.section-progress-meta {
    margin-top:6px;
    font-size:12px;
    color:#6b7280;
}
body.dark-theme .section-progress-meta {
    color:#94a3b8;
}

@media (max-width: 640px) {
  .app-drawer { width:min(340px, calc(100vw - 20px)); }
  .app-drawer-header { margin-bottom: 12px; }
  .app-drawer-title { font-size: 19px; }
  .app-drawer-subtitle { font-size: 12px; }
  .app-menu-list { gap: 8px; }
  .app-menu-item { padding: 10px 10px; }
  .app-menu-item-label { font-size: 13px; }
  .app-menu-item-badge { padding: 3px 7px; font-size: 10px; }
  .app-menu-children { gap: 6px; padding: 0 8px 8px; }
  .app-menu-subitem { padding: 9px 10px; border-radius: 12px; }
  .app-menu-subitem-label { font-size: 13px; }
  .section-progress-head { margin-bottom: 4px; }
  .section-progress-label, .section-progress-percent, .section-progress-meta { font-size: 11px; }
  .section-progress-bar { height: 8px; }
}

body.dark-theme .achievement-card-progress-meta {
    color: #dbe4f0 !important;
}




/* ===== COMPACT MENU + DIRECT ACHIEVEMENTS FIX ===== */
.app-drawer {
  width: min(328px, calc(100vw - 18px));
  padding: 10px 10px 12px;
}
.app-drawer-header {
  margin-bottom: 10px;
}
.app-drawer-title {
  font-size: 19px;
}
.app-drawer-subtitle {
  font-size: 12px;
  margin-top: 2px;
}
.app-menu-list {
  gap: 6px;
}
.app-menu-card,
.app-menu-item-standalone {
  border-radius: 14px;
}
.app-menu-item {
  padding: 10px 10px;
}
.app-menu-item-label {
  font-size: 13px;
}
.app-menu-item-badge {
  padding: 2px 7px;
  font-size: 10px;
}
.app-menu-children {
  gap: 6px;
  padding: 0 8px 8px;
}
.app-menu-subitem {
  border-radius: 12px;
  padding: 8px 10px;
}
.app-menu-subitem-label {
  font-size: 13px;
}
.section-progress-card {
  margin-top: 6px;
}
.section-progress-head,
.result-progress-head {
  margin-bottom: 5px;
  font-size: 11px;
}
.section-progress-track,
.section-progress-bar {
  height: 8px;
}
.section-progress-meta,
.result-progress-meta {
  margin-top: 5px;
  font-size: 11px;
}
.achievements-modal-direct-overlay {
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.achievements-panel-direct {
  width: min(1080px, 100%);
  max-height: 88vh;
}
@media (max-width: 640px) {
  .app-drawer {
    width: min(312px, calc(100vw - 14px));
    padding: 9px 9px 10px;
  }
  .app-drawer-actions {
    gap: 8px;
  }
  .app-drawer-close,
  .app-drawer-icon-button {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  .achievements-panel-direct {
    border-radius: 20px;
    padding: 14px;
  }
  .achievements-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .achievement-card {
    border-radius: 16px;
  }
}


/* Reliable achievements modal compact layout */
.achievements-panel {
  width: min(820px, 100%);
  max-height: 84vh;
}
.achievements-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.achievements-summary-card {
  padding: 10px 12px;
  border-radius: 16px;
}
.achievements-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.achievement-card {
  border-radius: 16px;
  padding: 10px;
}
.achievement-card-icon {
  font-size: 22px;
}
.achievement-card-title {
  font-size: 14px;
}
.achievement-card-desc,
.achievement-card-progress-meta,
.achievement-card-state,
.achievements-summary-note,
.achievements-summary-label,
.achievements-summary-value,
.achievements-summary-percent {
  font-size: 12px;
}
@media (min-width: 700px) {
  .achievements-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 640px) {
  .achievements-panel {
    width: min(100%, 100%);
    max-height: 88vh;
    padding: 12px;
    border-radius: 18px;
  }
  .history-panel-header {
    gap: 8px;
  }
  .history-title {
    font-size: 18px;
  }
  .history-subtitle {
    font-size: 11px;
  }
}

/* ===== RESULT SCREEN COMPACT FIX ===== */
.quiz-test-page .card .result-shell {
    gap: 10px;
    text-align: left;
}

.quiz-test-page .card .result-hero {
    padding-bottom: 2px;
    align-items: center;
}

.quiz-test-page .card .result-title {
    font-size: 22px;
    line-height: 1.12;
}

.quiz-test-page .card .result-subtitle {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.35;
}

.quiz-test-page .card .result-score-circle {
    width: 68px;
    height: 68px;
    font-size: 20px;
    box-shadow: 0 12px 26px rgba(109, 92, 255, 0.22);
}

.quiz-test-page .card .result-status-row {
    gap: 6px;
}

.quiz-test-page .card .result-status-chip {
    padding: 6px 9px;
    font-size: 11px;
}

.quiz-test-page .card .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.quiz-test-page .card .result-metric {
    padding: 9px;
    border-radius: 14px;
    gap: 7px;
}

.quiz-test-page .card .result-metric span {
    font-size: 16px;
}

.quiz-test-page .card .result-metric b {
    font-size: 13px;
    line-height: 1.2;
    word-break: break-word;
}

.quiz-test-page .card .result-metric small {
    font-size: 10px;
    line-height: 1.25;
}

.quiz-test-page .card .result-progress-block,
.quiz-test-page .card .result-achievements,
.quiz-test-page .card .result-note {
    padding: 10px 11px;
    border-radius: 14px;
}

.quiz-test-page .card .result-actions-stack {
    gap: 7px;
}

.quiz-test-page .card .result-actions-stack .main {
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 14px;
}

@media (max-width: 640px) {
    .quiz-test-page .card .result-hero {
        flex-direction: row;
        align-items: center;
    }

    .quiz-test-page .card .result-score-circle {
        width: 60px;
        height: 60px;
        font-size: 18px;
    }

    .quiz-test-page .card .result-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 380px) {
    .quiz-test-page .card .result-title {
        font-size: 20px;
    }

    .quiz-test-page .card .result-score-circle {
        width: 56px;
        height: 56px;
        font-size: 17px;
    }
}

/* ===== BURGER MENU LIVE INFO: WEATHER + USD RATE ===== */
.app-menu-live-info {
    margin-top: 14px;
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 18px;
    background: linear-gradient(145deg, #f8fafc 0%, #eef2ff 100%);
    box-shadow: 0 12px 26px rgba(79, 70, 229, 0.10);
    padding: 13px 13px 12px;
    color: #111827;
}

.app-menu-live-info-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.app-menu-live-info-title {
    font-size: 14px;
    font-weight: 900;
    color: #312e81;
    line-height: 1.15;
}

.app-menu-live-info-subtitle {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
}

.app-menu-live-info-refresh {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.84);
    color: #4f46e5;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.10);
}

.app-menu-live-info-refresh:disabled {
    opacity: 0.55;
    cursor: wait;
}

.app-menu-live-info.is-loading .app-menu-live-info-refresh {
    animation: appMenuLiveSpin 0.85s linear infinite;
}

@keyframes appMenuLiveSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.app-menu-live-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 0;
    border-top: 1px solid rgba(99, 102, 241, 0.13);
}

.app-menu-live-info-row span {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

.app-menu-live-info-row strong {
    color: #111827;
    font-size: 13px;
    font-weight: 900;
    text-align: right;
    white-space: nowrap;
}

.app-menu-live-info-updated {
    min-height: 14px;
    margin-top: 2px;
    color: #818cf8;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1.25;
}

.app-menu-live-info.has-error .app-menu-live-info-updated {
    color: #b45309;
}

body.dark-theme .app-menu-live-info {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.92), rgba(49, 46, 129, 0.62)) !important;
    border-color: rgba(129, 140, 248, 0.28) !important;
    color: #f8fafc !important;
    box-shadow: 0 14px 28px rgba(2, 6, 23, 0.42) !important;
}

body.dark-theme .app-menu-live-info-title,
body.dark-theme .app-menu-live-info-row strong {
    color: #f8fafc !important;
}

body.dark-theme .app-menu-live-info-subtitle,
body.dark-theme .app-menu-live-info-row span {
    color: #cbd5e1 !important;
}

body.dark-theme .app-menu-live-info-refresh {
    background: rgba(15, 23, 42, 0.82) !important;
    color: #c7d2fe !important;
    border-color: rgba(129, 140, 248, 0.30) !important;
}

body.dark-theme .app-menu-live-info-row {
    border-top-color: rgba(129, 140, 248, 0.18) !important;
}

body.dark-theme .app-menu-live-info-updated {
    color: #c4b5fd !important;
}

body.dark-theme .app-menu-live-info.has-error .app-menu-live-info-updated {
    color: #fcd34d !important;
}

@media (max-width: 640px) {
    .app-menu-live-info {
        margin-top: 12px;
        padding: 12px;
        border-radius: 16px;
    }

    .app-menu-live-info-row strong {
        font-size: 12.5px;
    }
}


body.dark-theme .news-date {
    background: rgba(79, 70, 229, 0.28) !important;
    color: #c4b5fd !important;
}

body.dark-theme .news-type {
    background: rgba(30, 41, 59, 0.92) !important;
    color: #e5e7eb !important;
}


.subscription-limit-info,
.limit-comparison-note {
    margin: 12px 0;
    padding: 11px 13px;
    border-radius: 16px;
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.20);
    color: #075985;
    font-size: 13px;
    font-weight: 750;
    line-height: 1.38;
    text-align: left;
}

.limit-comparison-note {
    margin-top: 12px;
    margin-bottom: 2px;
}

body.dark-theme .subscription-limit-info,
body.dark-theme .limit-comparison-note {
    background: rgba(14, 165, 233, 0.12);
    border-color: rgba(56, 189, 248, 0.22);
    color: #bae6fd;
}

/* ===== TEMPORARY DAILY LIMIT / PREMIUM COMPARISON ===== */
.temporary-limit-overlay .temporary-limit-panel {
    width: min(92vw, 460px);
}

.limit-plan-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 5px;
    margin: 12px 0 14px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.limit-plan-switch button {
    min-height: 44px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: #64748b;
    font-size: 14px;
    font-weight: 850;
    cursor: pointer;
    transition: 0.18s ease;
}

.limit-plan-switch button.active {
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.22);
}

.limit-plan-panel {
    border: 1px solid rgba(14, 165, 233, 0.20);
    border-radius: 20px;
    padding: 14px;
    background: linear-gradient(180deg, rgba(240, 249, 255, 0.98), rgba(255, 255, 255, 0.98));
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
    text-align: left;
}

.limit-plan-panel.hidden {
    display: none;
}

.limit-plan-title {
    margin-bottom: 10px;
    font-size: 17px;
    font-weight: 950;
    color: #0f172a;
}

.limit-plan-title.premium {
    color: #0369a1;
}

.limit-benefits-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 9px;
}

.limit-benefits-list li {
    position: relative;
    padding-left: 26px;
    color: #334155;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.limit-benefits-list li::before {
    content: "•";
    position: absolute;
    left: 4px;
    top: -1px;
    color: #94a3b8;
    font-size: 22px;
    line-height: 1;
}

.limit-benefits-list.premium li::before {
    content: "✓";
    left: 2px;
    top: 0;
    color: #0ea5e9;
    font-size: 16px;
    font-weight: 950;
}

.limit-actions {
    margin-top: 14px;
}

body.dark-theme .limit-plan-switch {
    background: rgba(15, 23, 42, 0.56);
    border-color: rgba(148, 163, 184, 0.18);
}

body.dark-theme .limit-plan-switch button {
    color: #cbd5e1;
}

body.dark-theme .limit-plan-switch button.active {
    color: #ffffff;
}

body.dark-theme .limit-plan-panel {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.92));
    border-color: rgba(56, 189, 248, 0.18);
}

body.dark-theme .limit-plan-title {
    color: #f8fafc;
}

body.dark-theme .limit-plan-title.premium {
    color: #7dd3fc;
}

body.dark-theme .limit-benefits-list li {
    color: #cbd5e1;
}

/* Quizora — free access release */
.intro-free-forever { position: absolute; left: 50%; bottom: max(105px, 17vh); transform: translateX(-50%); padding: 9px 18px; border-radius: 999px; border: 1px solid rgba(16,185,129,.3); background: rgba(16,185,129,.12); color: #059669; font: 700 15px/1.25 system-ui,sans-serif; white-space: nowrap; letter-spacing: .04em; }
#quizora-access-check { position:fixed; inset:0; z-index:2147483000; display:grid; place-items:center; background:var(--bg,#f5f6fb); color:var(--text,#172033); }
.access-check-card { text-align:center; padding:32px; font-family:system-ui,sans-serif; }
.access-check-card h1 { font-size:36px; letter-spacing:-.04em; margin:20px 0 8px; }
.access-check-card strong { color:#059669; }
.access-check-card p { color:#64748b; }
.access-spinner { display:inline-block; width:32px; height:32px; border:3px solid #dbe4ef; border-top-color:#10b981; border-radius:50%; animation:quizora-spin 1s linear infinite; }
@keyframes quizora-spin { to { transform:rotate(360deg); } }
#ban-overlay { z-index:2147483100; }
.access-ids { overflow-wrap:anywhere; font:13px/1.6 ui-monospace,monospace; padding:12px; background:rgba(100,116,139,.08); border-radius:12px; }
.quiz-user-name-badge-subtitle { color:#059669; }
@media(prefers-reduced-motion:reduce) { .access-spinner { animation:none; } }
.intro-splash-loader .intro-card-meta { display:inline-flex; align-items:center; width:auto; height:auto; min-height:22px; padding:3px 9px; background:#dcfce7; color:#166534; font:700 11px/1.3 system-ui,sans-serif; border-radius:999px; opacity:1; }
.intro-free-forever { color:#d1fae5; border-color:rgba(167,243,208,.45); background:rgba(6,78,59,.38); }
