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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    color: #e0e0e0;
    padding: 20px;
    min-height: 100vh;
}

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

/* Header Styles */
h1 {
    text-align: center;
    color: #00d4ff;
    margin-bottom: 40px;
    font-size: 2.8em;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

h2 {
    color: #00d4ff;
    font-size: 1.8em;
    margin-bottom: 20px;
}

/* Navigation Buttons (for home page) */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 50px;
}

.nav-card {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(155, 89, 182, 0.1));
    border-radius: 15px;
    padding: 30px;
    border: 2px solid rgba(0, 212, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.nav-card:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 212, 255, 0.6);
    box-shadow: 0 12px 40px rgba(0, 212, 255, 0.4);
}

.nav-card h3 {
    color: #00d4ff;
    font-size: 1.6em;
    margin-bottom: 15px;
}

.nav-card p {
    color: #b0b0b0;
    font-size: 1.1em;
}

/* Back to Home Button */
.back-home {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    margin-bottom: 30px;
    transition: all 0.3s;
}

.back-home:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Theory Section */
.theory-section {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(155, 89, 182, 0.1));
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    border: 2px solid rgba(0, 212, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.theory-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    user-select: none;
}

.theory-header h2 {
    color: #00d4ff;
    font-size: 2em;
    margin-bottom: 0;
}

.toggle-icon {
    font-size: 1.5em;
    transition: transform 0.3s;
    color: #00d4ff;
}

.toggle-icon.rotated {
    transform: rotate(180deg);
}

.theory-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.theory-content.active {
    max-height: 8000px;
    transition: max-height 0.6s ease-in;
}

/* Rule Boxes */
.rule-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    margin: 15px 0;
    border-left: 4px solid #00d4ff;
}

.rule-title {
    color: #00d4ff;
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 10px;
}

.rule-formula {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    font-size: 1.3em;
    text-align: center;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
}

.rule-explanation {
    color: #b0b0b0;
    line-height: 1.8;
    margin-top: 10px;
}

.example-simple {
    background: rgba(0, 212, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 3px solid #00d4ff;
}

/* Warning and Tip Boxes */
.warning-box {
    background: rgba(238, 82, 83, 0.2);
    border: 2px solid rgba(238, 82, 83, 0.5);
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
}

.warning-box strong {
    color: #ee5253;
}

.tip-box {
    background: rgba(46, 213, 115, 0.2);
    border: 2px solid rgba(46, 213, 115, 0.5);
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
}

.tip-box strong {
    color: #2ed573;
}

/* Difficulty Badges */
.difficulty-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
    margin-bottom: 20px;
}

.diff-easy { background: rgba(46, 213, 115, 0.3); color: #2ed573; }
.diff-medium { background: rgba(255, 159, 67, 0.3); color: #ff9f43; }
.diff-hard { background: rgba(238, 82, 83, 0.3); color: #ee5253; }
.diff-extreme { background: rgba(153, 0, 255, 0.3); color: #c77dff; }

/* Type Section (collapsible sections for different exercise types) */
.type-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    margin-bottom: 25px;
    overflow: hidden;
    border: 1px solid rgba(0, 212, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.type-header {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(155, 89, 182, 0.2));
    padding: 20px 25px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
    border-bottom: 2px solid rgba(0, 212, 255, 0.3);
    user-select: none;
}

.type-header:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(155, 89, 182, 0.3));
}

.type-header h2 {
    color: #00d4ff;
    font-size: 1.6em;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 0;
}

.type-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.type-content.active {
    max-height: 10000px;
    transition: max-height 0.6s ease-in;
}

/* Example Cards */
.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin: 20px;
}

.example-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.example-card:hover {
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.2);
}

.example-task {
    font-size: 1.4em;
    color: #fff;
    margin-bottom: 15px;
    font-weight: 500;
    min-height: 40px;
    display: flex;
    align-items: center;
}

.example-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

/* Buttons */
.answer-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: bold;
    transition: all 0.3s;
    flex: 1;
}

.answer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.steps-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: bold;
    transition: all 0.3s;
    flex: 1;
}

.steps-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.4);
}

/* Steps Content */
.steps-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    margin-top: 10px;
}

.steps-content.active {
    max-height: 3000px;
    transition: max-height 0.5s ease-in;
}

.step {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    border-left: 4px solid #00d4ff;
    line-height: 1.8;
}

.step-title {
    color: #00d4ff;
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 1.05em;
}

/* Color highlights for math expressions */
.color-final {
    color: #ffd32a;
    font-weight: bold;
    font-size: 1.1em;
}

.color-coeff { color: #00d4ff; font-weight: bold; }
.color-sqrt { color: #2ed573; font-weight: bold; }
.color-result { color: #ffa502; font-weight: bold; }
.color-transform { color: #ff6b9d; font-weight: bold; }
.color-operation { color: #c77dff; font-weight: bold; }
.color-same { color: #00f2fe; font-weight: bold; }

/* Quick Examples Section */
.quick-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.quick-section h3 {
    color: #00d4ff;
    margin-bottom: 15px;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.quick-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.quick-card:hover {
    border-color: rgba(0, 212, 255, 0.5);
}

.quick-task {
    font-size: 1.1em;
    color: #fff;
    margin-bottom: 8px;
}

.quick-answer {
    font-size: 0.95em;
    color: #00d4ff;
}

/* Control buttons */
.control-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.expand-all-btn, .collapse-all-btn {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
    border: 2px solid #00d4ff;
    padding: 10px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: all 0.3s;
}

.expand-all-btn:hover, .collapse-all-btn:hover {
    background: rgba(0, 212, 255, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    h1 {
        font-size: 2em;
        margin-bottom: 25px;
    }
    
    .theory-header h2 {
        font-size: 1.5em;
    }
    
    .type-header h2 {
        font-size: 1.3em;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
        margin: 10px;
    }
    
    .quick-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-grid {
        grid-template-columns: 1fr;
    }
    
    .example-task {
        font-size: 1.2em;
    }
    
    .example-buttons {
        flex-direction: column;
    }
    
    .answer-btn, .steps-btn {
        width: 100%;
    }
    
    .theory-section, .type-section {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.6em;
    }
    
    .example-task {
        font-size: 1.1em;
    }
    
    .rule-formula {
        font-size: 1.1em;
    }
}
