/* === CSS Variables & Reset === */
:root {
    --bg: #f5f7fa;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f4f8;
    --bg-sidebar: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --accent: #1a73e8;
    --accent-light: #4a9af5;
    --accent-glow: rgba(26, 115, 232, 0.3);
    --sin-color: #e17055;
    --cos-color: #00b894;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #e17055;
    --border: #dde1e8;
    --radius: 12px;
    --sidebar-width: 280px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* === Sidebar === */
#sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.sidebar-header .accent {
    color: var(--accent-light);
}

.sidebar-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.nav-list {
    list-style: none;
    padding: 0.5rem 0;
    flex: 1;
    overflow-y: auto;
}

.nav-section-title {
    padding: 1rem 1.5rem 0.4rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.6rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    gap: 0.7rem;
}

.nav-link:hover {
    color: var(--text);
    background: rgba(26, 115, 232, 0.08);
}

.nav-link.active {
    color: var(--accent-light);
    background: rgba(26, 115, 232, 0.12);
    border-left-color: var(--accent);
}

.nav-link.completed {
    color: var(--success);
}

.nav-link.completed::after {
    content: '✓';
    margin-left: auto;
    font-size: 0.75rem;
}

.nav-icon {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 1.5rem;
    text-align: center;
    opacity: 0.6;
}

.nav-link.active .nav-icon {
    opacity: 1;
}

/* === Sidebar Stats === */
.sidebar-stats {
    padding: 0.8rem 1.5rem;
    border-top: 1px solid var(--border);
}

.stats-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 0.3rem;
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-light);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 2px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.4rem;
}

/* === Mobile Header === */
#mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    z-index: 99;
    align-items: center;
    padding: 0 1rem;
    gap: 1rem;
}

#menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

#menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: var(--transition);
}

#mobile-header h1 {
    font-size: 0.95rem;
    font-weight: 600;
}

/* === Main Content === */
#content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

.section {
    display: none;
    padding: 2rem 3rem;
    max-width: 960px;
    animation: fadeIn 0.4s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Section Header === */
.section-header {
    margin-bottom: 2rem;
}

.section-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.badge {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.3rem 0.9rem;
    background: rgba(26, 115, 232, 0.15);
    color: var(--accent-light);
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
}

/* === Cards === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.2rem;
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(26, 115, 232, 0.3);
}

.card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: var(--text);
}

.card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card p, .card li {
    color: var(--text-muted);
    line-height: 1.8;
}

.card ul, .card ol {
    padding-left: 1.5rem;
}

.card li {
    margin-bottom: 0.3rem;
}

.highlight-card {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(26, 115, 232, 0.08), rgba(74, 154, 245, 0.05));
}

.warning-card {
    border-color: var(--danger);
    background: linear-gradient(135deg, rgba(225, 112, 85, 0.08), rgba(225, 112, 85, 0.03));
}

.interactive-card {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(0, 184, 148, 0.08), rgba(0, 184, 148, 0.03));
}

/* === Criteria Table === */
.criteria-table {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.criteria-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.02);
}

.criteria-row .score {
    font-weight: 700;
    white-space: nowrap;
    min-width: 70px;
}

.score-2 .score { color: var(--success); }
.score-1 .score { color: var(--warning); }
.score-0 .score { color: var(--danger); }

/* === Problem Box === */
.problem-box {
    background: rgba(26, 115, 232, 0.08);
    border: 1px solid rgba(26, 115, 232, 0.2);
    border-radius: 8px;
    padding: 1.2rem;
    position: relative;
}

.problem-box p {
    color: var(--text) !important;
    margin-bottom: 0.5rem;
}

.source-tag {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: var(--accent);
    color: white;
    border-radius: 4px;
    font-weight: 600;
}

/* === Skills Grid === */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.skill-item {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.skill-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.skill-number {
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.skill-item h4 {
    color: var(--text);
    margin-bottom: 0.3rem;
}

.skill-item p {
    font-size: 0.82rem;
}

/* === Unit Circle === */
.circle-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: center;
}

#unitCircleCanvas {
    border-radius: var(--radius);
    cursor: crosshair;
    max-width: 100%;
    height: auto;
}

.circle-info {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    min-width: 200px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    font-size: 1rem;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-muted);
    font-weight: 500;
}

.sin-color { color: var(--sin-color); font-weight: 600; }
.cos-color { color: var(--cos-color); font-weight: 600; }

.standard-angles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 1rem;
    justify-content: center;
}

.angle-btn {
    padding: 0.35rem 0.7rem;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
}

.angle-btn:hover, .angle-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* === Tables === */
.table-scroll {
    overflow-x: auto;
}

.trig-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.trig-table th, .trig-table td {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    text-align: center;
}

.trig-table th {
    background: rgba(26, 115, 232, 0.12);
    color: var(--accent-light);
    font-weight: 600;
    white-space: nowrap;
}

.trig-table td {
    background: rgba(0, 0, 0, 0.02);
}

.trig-table tr:hover td {
    background: rgba(26, 115, 232, 0.06);
}

/* === Conversion Tool === */
.conversion-tool {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1rem;
}

.conv-input label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.conv-input input {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.8rem;
    color: var(--text);
    font-size: 1rem;
    width: 120px;
    outline: none;
}

.conv-input input:focus {
    border-color: var(--accent);
}

.conv-arrow {
    font-size: 1.5rem;
    color: var(--accent-light);
    margin-top: 1rem;
}

/* === Quadrants Grid === */
.quadrants-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    max-width: 500px;
    margin: 0 auto;
}

.quadrant {
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.quadrant h4 {
    margin-bottom: 0.5rem;
}

.q1 { background: rgba(0, 184, 148, 0.1); border: 1px solid rgba(0, 184, 148, 0.3); }
.q2 { background: rgba(253, 203, 110, 0.1); border: 1px solid rgba(253, 203, 110, 0.3); }
.q3 { background: rgba(225, 112, 85, 0.1); border: 1px solid rgba(225, 112, 85, 0.3); }
.q4 { background: rgba(26, 115, 232, 0.1); border: 1px solid rgba(26, 115, 232, 0.3); }

/* === Formula Tabs === */
.formula-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.formula-tab {
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.formula-tab:hover {
    border-color: var(--accent);
    color: var(--text);
}

.formula-tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* === Formula Lists === */
.formula-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.formula-item {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.formula-main {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.formula-note {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.formula-sub {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    padding-left: 1rem;
}

.given-tag {
    color: var(--success) !important;
    font-weight: 500;
}

.learn-tag {
    color: var(--warning) !important;
    font-weight: 500;
}

.formula-given {
    background: rgba(0, 184, 148, 0.08);
    border: 1px solid rgba(0, 184, 148, 0.2);
    border-radius: 8px;
    padding: 1rem;
    font-size: 1.05rem;
}

.formula-given p {
    color: var(--text) !important;
    margin-bottom: 0.3rem;
}

/* === Tip & Example Boxes === */
.tip-box {
    background: rgba(253, 203, 110, 0.08);
    border: 1px solid rgba(253, 203, 110, 0.2);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.example-box {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.8rem;
}

/* === Solution Toggle === */
.solution-toggle {
    color: var(--accent-light);
    cursor: pointer;
    font-size: 0.88rem;
    padding: 0.5rem 0;
    user-select: none;
    transition: var(--transition);
}

.solution-toggle:hover {
    color: var(--accent);
}

.solution-toggle::before {
    content: '▶ ';
    font-size: 0.7rem;
    transition: var(--transition);
}

.solution-toggle.open::before {
    content: '▼ ';
}

.solution-content {
    display: none;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}

.solution-content.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.solution-content p {
    color: var(--text) !important;
    margin-bottom: 0.4rem;
}

.note-text {
    color: var(--warning) !important;
    font-size: 0.85rem;
    font-style: italic;
}

/* === Method Cards === */
.method-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.method-card {
    position: relative;
}

.method-number {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    background: var(--accent);
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* === Quiz Elements === */
.quiz-question {
    font-size: 1.2rem;
    text-align: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    margin-bottom: 1rem;
    min-height: 60px;
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.quiz-options.two-col {
    grid-template-columns: 1fr 1fr;
    max-width: 300px;
    margin: 0 auto 1rem;
}

.quiz-feedback {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    min-height: 45px;
    transition: all 0.3s ease;
}

.quiz-feedback.correct {
    background: rgba(0, 184, 148, 0.2);
    color: #00b894;
    border: 2px solid rgba(0, 184, 148, 0.5);
    box-shadow: 0 0 18px rgba(0, 184, 148, 0.25);
    animation: correctPulse 0.5s ease;
}

.quiz-feedback.wrong {
    background: rgba(225, 112, 85, 0.2);
    color: #e17055;
    border: 2px solid rgba(225, 112, 85, 0.5);
    box-shadow: 0 0 18px rgba(225, 112, 85, 0.25);
    animation: wrongShake 0.4s ease;
}

@keyframes correctPulse {
    0% { transform: scale(0.95); opacity: 0; }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.quiz-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.quiz-input-row select {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem;
    color: var(--text);
    font-size: 0.95rem;
}

.quiz-stats {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 1rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.quiz-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.quiz-input-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    transition: var(--transition);
}

.quiz-input-group label:hover {
    background: rgba(0, 0, 0, 0.03);
}

.quiz-input-group input[type="checkbox"] {
    accent-color: var(--accent);
}

/* === Buttons === */
.btn {
    padding: 0.55rem 1.2rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-muted);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text);
}

.btn-option {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.7rem 1rem;
}

.btn-option:hover {
    border-color: var(--accent);
    background: rgba(26, 115, 232, 0.1);
}

.btn-option.selected-correct {
    background: rgba(0, 184, 148, 0.2);
    border-color: var(--success);
    color: var(--success);
}

.btn-option.selected-wrong {
    background: rgba(225, 112, 85, 0.2);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-large {
    padding: 0.8rem 2rem;
    font-size: 1rem;
}

/* === Exam Mode === */
.exam-settings {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.setting-row label {
    min-width: 200px;
    color: var(--text-muted);
}

.setting-row select {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.8rem;
    color: var(--text);
    font-size: 0.95rem;
}

.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.exam-progress {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.exam-timer {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--accent-light);
}

.exam-timer.warning {
    color: var(--warning);
}

.exam-timer.danger {
    color: var(--danger);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    50% { opacity: 0.5; }
}

.exam-answer {
    margin-top: 1rem;
}

.exam-answer textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    font-family: inherit;
}

.exam-answer textarea:focus {
    border-color: var(--accent);
}

.exam-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.hint-box {
    background: rgba(253, 203, 110, 0.1);
    border: 1px solid rgba(253, 203, 110, 0.3);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

/* === Cheat Sheet === */
.cheat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.cheat-card {
    text-align: center;
}

.cheat-card h4 {
    color: var(--accent-light);
    margin-bottom: 0.8rem;
}

/* === Problem Card === */
.problem-card {
    margin-bottom: 1.5rem;
}

.problem-card .problem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.problem-tag {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.tag-basic { background: rgba(0, 184, 148, 0.15); color: var(--success); }
.tag-medium { background: rgba(253, 203, 110, 0.15); color: var(--warning); }
.tag-hard { background: rgba(225, 112, 85, 0.15); color: var(--danger); }
.tag-fipi { background: rgba(26, 115, 232, 0.15); color: var(--accent-light); }

.problem-text {
    font-size: 1.05rem;
    color: var(--text) !important;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.problem-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.step {
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--accent);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 0 6px 6px 0;
}

.step-number {
    font-weight: 700;
    color: var(--accent-light);
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
}

.answer-box {
    background: rgba(0, 184, 148, 0.1);
    border: 1px solid rgba(0, 184, 148, 0.3);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.5rem;
    font-weight: 600;
}

/* === Reduction Table === */
.reduction-table td, .reduction-table th {
    font-size: 0.82rem;
    padding: 0.5rem;
}

/* === Interactive Visualizer === */
.viz-layout {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
}

.viz-controls {
    min-width: 260px;
    flex: 1;
}

.viz-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.viz-row label {
    min-width: 100px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.viz-row select, .viz-row input[type="text"] {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    color: var(--text);
    font-size: 0.88rem;
}

.viz-row input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
    min-width: 150px;
}

.interval-inputs {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.interval-inputs input {
    width: 70px !important;
}

.viz-solutions {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.viz-formula {
    font-size: 0.92rem;
    color: var(--accent-light);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.viz-roots-title {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.viz-roots-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.viz-root {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 184, 148, 0.12);
    border: 1px solid rgba(0, 184, 148, 0.3);
    border-radius: 4px;
    font-size: 0.82rem;
    color: var(--success);
    font-weight: 500;
}

.viz-no-sol {
    color: var(--danger);
    font-size: 0.88rem;
}

.nl-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 1rem;
}

/* Step solver */
.step-solver {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.solver-step {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: var(--transition);
}

.solver-step.active {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(26, 115, 232, 0.2);
}

.solver-step.completed {
    border-color: var(--success);
    opacity: 0.8;
}

.solver-step.pending {
    opacity: 0.4;
}

.solver-step-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    background: rgba(0, 0, 0, 0.02);
    cursor: pointer;
}

.solver-step-num {
    width: 24px;
    height: 24px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.solver-step.completed .solver-step-num {
    background: var(--success);
}

.solver-step.pending .solver-step-num {
    background: var(--border);
}

.solver-step-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.solver-check {
    margin-left: auto;
    color: var(--success);
    font-weight: 700;
}

.solver-step-content {
    padding: 0 1rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.solver-step-content.visible {
    padding: 0.8rem 1rem;
    max-height: 500px;
}

.solver-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    margin-top: 0.5rem;
}

.solver-progress {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* === Responsive === */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }

    #mobile-header {
        display: flex;
    }

    #content {
        margin-left: 0;
        padding-top: 56px;
    }

    .section {
        padding: 1rem;
    }

    .section-header h1 {
        font-size: 1.4rem;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }

    .circle-container {
        flex-direction: column;
        align-items: center;
    }

    .quadrants-grid {
        max-width: 100%;
    }

    .setting-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .setting-row label {
        min-width: auto;
    }

    .exam-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .formula-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
    }

    .formula-tab {
        white-space: nowrap;
    }

    .cheat-grid {
        grid-template-columns: 1fr;
    }

    .reduction-table {
        font-size: 0.7rem;
    }

    /* Touch targets */
    .btn, .nav-link, button {
        min-height: 44px;
    }

    .nav-link {
        padding: 12px 14px;
    }

    /* Formula blocks: prevent overflow */
    .formula-block, .formula-given {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Trainer inputs full width */
    .quiz-input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .quiz-input-row input {
        width: 100%;
    }
}

/* iOS input zoom prevention */
@media (max-width: 768px) {
    input, select, textarea {
        font-size: 16px;
    }

    /* Tables: horizontal scroll */
    .styled-table, .reduction-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* === Algorithm Flow (Item 2) === */
.algorithm-card {
    border-color: var(--accent);
}

.algorithm-flow {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 1rem;
}

.algorithm-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.2rem;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: var(--transition);
}

.algorithm-step:hover {
    border-color: var(--accent);
    background: rgba(26, 115, 232, 0.06);
}

.algorithm-step-final {
    border-color: var(--success);
    background: rgba(0, 184, 148, 0.06);
}

.algorithm-step-num {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 800;
}

.algorithm-step-final .algorithm-step-num {
    background: var(--success);
}

.algorithm-step-text {
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.5;
}

.algorithm-arrow {
    width: 2px;
    height: 18px;
    background: var(--accent);
    margin-left: 17px;
    position: relative;
}

.algorithm-arrow::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--accent);
}

/* === Error Examples (Item 3) === */
.error-example {
    margin-top: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.error-example:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.error-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.8rem;
}

.error-wrong {
    background: rgba(225, 112, 85, 0.08);
    border: 2px solid rgba(225, 112, 85, 0.4);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.6rem;
    position: relative;
}

.error-correct {
    background: rgba(0, 184, 148, 0.08);
    border: 2px solid rgba(0, 184, 148, 0.4);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.6rem;
    position: relative;
}

.error-label {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.error-label-wrong {
    background: rgba(225, 112, 85, 0.25);
    color: var(--danger);
}

.error-label-correct {
    background: rgba(0, 184, 148, 0.25);
    color: var(--success);
}

.error-content p {
    color: var(--text) !important;
    margin-bottom: 0.3rem;
}

.error-explanation {
    background: rgba(253, 203, 110, 0.1);
    border: 1px solid rgba(253, 203, 110, 0.3);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    color: var(--warning);
    font-weight: 500;
}

/* === Problem Counter (Item 1 - solved counter) === */
.solved-counter {
    display: inline-block;
    padding: 0.35rem 0.9rem;
    background: rgba(0, 184, 148, 0.12);
    border: 1px solid rgba(0, 184, 148, 0.3);
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--success);
    margin-left: 1rem;
}

/* === Progressive Hints (Item 4) === */
.hint-box.hint-level-1 {
    border-color: rgba(253, 203, 110, 0.4);
}

.hint-box.hint-level-2 {
    border-color: rgba(225, 112, 85, 0.4);
    background: rgba(225, 112, 85, 0.08);
}

.hint-box.hint-level-3 {
    border-color: rgba(26, 115, 232, 0.4);
    background: rgba(26, 115, 232, 0.08);
}

.hint-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.hint-label-1 {
    background: rgba(253, 203, 110, 0.2);
    color: var(--warning);
}

.hint-label-2 {
    background: rgba(225, 112, 85, 0.2);
    color: var(--danger);
}

.hint-label-3 {
    background: rgba(26, 115, 232, 0.2);
    color: var(--accent-light);
}

/* === Flash Cards (Item 5) === */
.flash-card-stats {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.flash-card-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.flash-card {
    width: 100%;
    max-width: 500px;
    min-height: 140px;
    background: rgba(0, 0, 0, 0.02);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 1rem;
}

.flash-card:hover {
    border-color: var(--accent);
}

.flash-card-question {
    font-size: 1.15rem;
    color: var(--text);
    line-height: 1.6;
}

.flash-card-answer {
    font-size: 1.15rem;
    color: var(--success);
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    line-height: 1.6;
    width: 100%;
}

.flash-card-actions,
.flash-card-verdict {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
}

.flash-btn-know {
    background: var(--success) !important;
}

.flash-btn-know:hover {
    background: #00d9a7 !important;
}

.flash-btn-repeat {
    background: var(--danger) !important;
}

.flash-btn-repeat:hover {
    background: #ff7b6b !important;
}
