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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f4f8;
    color: #1a202c;
    min-height: 100vh;
}

#app {
    max-width: 700px;
    margin: 0 auto;
    padding: 16px;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.hero {
    text-align: center;
    padding: 32px 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 16px;
    color: #fff;
    margin-bottom: 20px;
}

.hero h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 0.95rem;
    opacity: 0.85;
    margin-bottom: 20px;
}

.progress-container {
    max-width: 320px;
    margin: 0 auto;
}

.progress-bar {
    background: rgba(255,255,255,0.25);
    border-radius: 10px;
    height: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: #48bb78;
    border-radius: 10px;
    width: 0%;
    transition: width 0.4s ease;
}

.progress-text {
    font-size: 0.85rem;
    opacity: 0.9;
}

.topics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.topic-badge {
    background: #e2e8f0;
    color: #4a5568;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

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

.question-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.question-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102,126,234,0.15);
}

.question-item.completed {
    border-color: #48bb78;
}

.question-number {
    width: 40px;
    height: 40px;
    background: #edf2f7;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: #667eea;
    flex-shrink: 0;
}

.question-item.completed .question-number {
    background: #c6f6d5;
    color: #276749;
}

.question-info {
    flex: 1;
}

.question-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.question-topic {
    font-size: 0.78rem;
    color: #718096;
}

.question-nav-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.btn-back {
    background: none;
    border: none;
    color: #667eea;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
}

.counter {
    font-size: 0.9rem;
    color: #718096;
    font-weight: 600;
}

.question-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.card-number {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: #fff;
    flex-shrink: 0;
}

.card-meta h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.card-topic {
    font-size: 0.8rem;
    color: #667eea;
    font-weight: 500;
}

.card-graph {
    text-align: center;
    margin-bottom: 16px;
    padding: 12px;
    background: #f7fafc;
    border-radius: 10px;
}

.card-graph svg {
    display: block;
    margin: 0 auto;
}

.card-question {
    background: #f7fafc;
    border-left: 4px solid #667eea;
    padding: 16px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.7;
}

.card-solution {
    display: none;
}

.card-solution.visible {
    display: block;
}

.step {
    margin-bottom: 16px;
    padding: 14px;
    background: #f7fafc;
    border-radius: 10px;
}

.step-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #4a5568;
    margin-bottom: 8px;
}

.step-content {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #2d3748;
}

.step-content .katex-display {
    margin: 12px 0;
}

.result-box {
    background: linear-gradient(135deg, #f0fff4, #e6fffa);
    border: 2px solid #48bb78;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: #276749;
    margin-top: 16px;
}

.question-nav-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 40px;
}

.btn-nav {
    background: #edf2f7;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-nav:hover:not(:disabled) {
    background: #e2e8f0;
}

.btn-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-check {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-check:hover {
    opacity: 0.9;
}

.btn-check.completed {
    background: #48bb78;
}

.graph-img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 12px auto;
    border-radius: 8px;
}

@media (max-width: 500px) {
    #app {
        padding: 10px;
    }

    .hero {
        padding: 24px 12px;
    }

    .hero h1 {
        font-size: 1.3rem;
    }

    .question-card {
        padding: 16px;
    }

    .btn-nav {
        padding: 10px 14px;
        font-size: 0.82rem;
    }

    .btn-check {
        padding: 10px 18px;
        font-size: 0.88rem;
    }
}
