:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.72);
    --panel-border: rgba(148, 163, 184, 0.18);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at top right, rgba(79, 70, 229, 0.18), transparent 28%), radial-gradient(circle at top left, rgba(236, 72, 153, 0.12), transparent 24%);
    color: var(--text-main);
}

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.back-link {
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 600;
}

.back-link:hover {
    color: #ffffff;
}

.answer-btn {
    border: 1px solid rgba(71, 85, 105, 0.8);
    background: rgba(15, 23, 42, 0.78);
    color: var(--text-main);
    border-radius: 1rem;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.answer-btn:hover {
    border-color: rgba(99, 102, 241, 0.9);
    background: rgba(30, 41, 59, 0.92);
    transform: translateY(-1px);
}

.answer-btn.is-correct {
    border-color: rgba(16, 185, 129, 0.95);
    background: rgba(6, 95, 70, 0.5);
}

.answer-btn.is-wrong {
    border-color: rgba(239, 68, 68, 0.95);
    background: rgba(127, 29, 29, 0.45);
}

.answer-btn:disabled {
    cursor: default;
    opacity: 0.92;
    transform: none;
}

.level-chip {
    border: 1px solid rgba(71, 85, 105, 0.8);
    background: rgba(15, 23, 42, 0.7);
    border-radius: 0.9rem;
    padding: 0.75rem 0.9rem;
    color: var(--text-dim);
}

.level-chip strong {
    color: #f8fafc;
}

.grade-btn {
    border-radius: 1rem;
    padding: 0.9rem 1rem;
    font-weight: 700;
    border: 1px solid transparent;
    transition: 0.2s ease;
}

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

.grade-again {
    background: rgba(127, 29, 29, 0.35);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fca5a5;
}

.grade-hard {
    background: rgba(120, 53, 15, 0.35);
    border-color: rgba(251, 191, 36, 0.35);
    color: #fcd34d;
}

.grade-good {
    background: rgba(49, 46, 129, 0.35);
    border-color: rgba(129, 140, 248, 0.35);
    color: #c7d2fe;
}

.grade-easy {
    background: rgba(6, 95, 70, 0.35);
    border-color: rgba(52, 211, 153, 0.35);
    color: #a7f3d0;
}

.theory-math {
    color: #e2e8f0;
}

.theory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.theory-card {
    border: 1px solid rgba(71, 85, 105, 0.75);
    background: rgba(15, 23, 42, 0.82);
    border-radius: 1.25rem;
    padding: 1rem 1rem 1.1rem;
}

.theory-card--wide {
    grid-column: span 2;
}

.theory-label {
    margin: 0;
    color: #f8fafc;
    font-size: 0.98rem;
    font-weight: 800;
    line-height: 1.35;
}

.theory-note {
    margin: 0.35rem 0 0;
    color: #94a3b8;
    font-size: 0.8rem;
    line-height: 1.4;
}

.theory-formula {
    margin-top: 0.7rem;
    color: #ffffff;
    font-size: 1.08rem;
    line-height: 1.7;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.15rem;
}

.theory-table-wrap {
    margin-top: 0.9rem;
    overflow-x: auto;
    border: 1px solid rgba(71, 85, 105, 0.7);
    border-radius: 1rem;
}

.theory-table {
    width: 100%;
    min-width: 420px;
    border-collapse: collapse;
    color: #e2e8f0;
    background: rgba(2, 6, 23, 0.45);
}

.theory-table th,
.theory-table td {
    padding: 0.9rem 0.75rem;
    border-bottom: 1px solid rgba(71, 85, 105, 0.45);
    text-align: center;
    vertical-align: middle;
}

.theory-table th {
    background: rgba(30, 41, 59, 0.82);
    color: #f8fafc;
    font-size: 0.92rem;
    font-weight: 800;
}

.theory-table tbody tr:last-child td {
    border-bottom: none;
}

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

    .theory-card--wide {
        grid-column: auto;
    }

    .theory-card {
        padding: 0.95rem;
    }

    .theory-formula {
        font-size: 1rem;
    }
}

.tab-btn.is-active {
    background: rgb(79 70 229);
    color: #ffffff;
}

.task-list-panel {
    display: grid;
    gap: 14px;
}

.task-list-card {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.72);
    padding: 18px;
}

.task-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.task-list-index {
    font-size: 0.95rem;
    font-weight: 800;
    color: #f8fafc;
}

.task-level-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.14);
    color: #bfdbfe;
    font-size: 0.8rem;
    font-weight: 700;
}

.task-list-question {
    margin: 0 0 12px;
    color: #e2e8f0;
    line-height: 1.6;
}

.task-list-expression {
    margin-top: 8px;
}

.hidden {
    display: none;
}
