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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f5;
    color: #2c3e50;
    line-height: 1.6;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
}

nav {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.nav-link {
    padding: 10px 20px;
    background: white;
    border-radius: 10px;
    text-decoration: none;
    color: #667eea;
    font-weight: 600;
    border: 2px solid #667eea;
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: #667eea;
    color: white;
}

.topic-intro {
    background: white;
    padding: 24px;
    border-radius: 14px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.topic-intro h2 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.hidden {
    display: none;
}

.formula {
    background: #f8f9ff;
    border-left: 4px solid #667eea;
    padding: 14px 20px;
    margin: 14px 0;
    font-size: 1.15rem;
    font-family: 'Georgia', serif;
    font-style: italic;
    border-radius: 0 8px 8px 0;
}

.question {
    background: white;
    padding: 24px;
    border-radius: 14px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-left: 5px solid #667eea;
}

.question h3 {
    color: #764ba2;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.diagram {
    display: flex;
    justify-content: center;
    margin: 16px 0;
}

.diagram svg {
    max-width: 100%;
    width: 380px;
    height: auto;
}

.dim-label {
    font-size: 14px;
    font-weight: 700;
    fill: #2c3e50;
    font-family: 'Segoe UI', sans-serif;
}

.dim-label-small {
    font-size: 13px;
    font-weight: 600;
    fill: #555;
    font-family: 'Segoe UI', sans-serif;
}

.note {
    font-size: 0.9rem;
    color: #7f8c8d;
    font-style: italic;
    margin: 8px 0;
}

.answer-section {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0 10px;
    flex-wrap: wrap;
}

.answer-input {
    padding: 10px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    width: 180px;
    transition: border-color 0.2s;
}

.answer-input:focus {
    outline: none;
    border-color: #667eea;
}

.answer-input:disabled,
.answer-select:disabled {
    background: #f0f0f0;
    color: #999;
    cursor: not-allowed;
    border-color: #ddd;
}

.check-btn:disabled {
    background: #bbb;
    cursor: not-allowed;
}

.answer-select {
    padding: 10px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
}

.unit {
    font-weight: 600;
    color: #7f8c8d;
}

.check-btn {
    padding: 10px 22px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.check-btn:hover {
    background: #5a6fd6;
}

.feedback {
    font-weight: 700;
    font-size: 1rem;
    margin-left: 4px;
}

.feedback.correct {
    color: #27ae60;
}

.feedback.incorrect {
    color: #e74c3c;
}

details {
    margin-top: 10px;
}

details summary {
    cursor: pointer;
    color: #667eea;
    font-weight: 600;
    padding: 6px 0;
    user-select: none;
}

details summary:hover {
    color: #764ba2;
}

.hint p, .solution-steps p {
    margin: 6px 0;
    padding-left: 10px;
}

.solution-steps {
    background: #f8f9ff;
    padding: 14px 18px;
    border-radius: 8px;
    margin-top: 8px;
}

footer {
    text-align: center;
    padding: 20px;
    color: #95a5a6;
    font-size: 0.9rem;
    margin-top: 20px;
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .question {
        padding: 16px;
    }

    .diagram svg {
        width: 100%;
    }

    .answer-input {
        width: 140px;
    }
}
