:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #333333;
    --text-secondary: #666666;
    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --border-color: #e0e0e0;
    --grid-color: #e0e0e0;
    --canvas-bg: #fafafa;
    --warning-bg: #fff3cd;
    --warning-border: #ffeaa7;
    --warning-text: #856404;
    --instruction-bg: #e3f2fd;
    --instruction-border: #2196f3;
    --instruction-text: #333333;
    --shadow: rgba(0, 0, 0, 0.1);
    --point-color: #764ba2;
    --curve-color: #667eea;
}

body.dark-mode {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --accent-primary: #8b9dc3;
    --accent-secondary: #a67bc5;
    --border-color: #4a4a4a;
    --grid-color: #4a4a4a;
    --canvas-bg: #2d2d2d;
    --warning-bg: #3d3d2d;
    --warning-border: #6b5d1f;
    --warning-text: #d4c896;
    --instruction-bg: #2d3d4d;
    --instruction-border: #1e5f8e;
    --instruction-text: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.3);
    --point-color: #a67bc5;
    --curve-color: #8b9dc3;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: all 0.3s ease;
}

.container {
    background: var(--bg-primary);
    border-radius: 20px;
    box-shadow: 0 20px 40px var(--shadow);
    padding: 30px;
    max-width: 1000px;
    width: 100%;
    transition: all 0.3s ease;
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    color: var(--text-primary);
    font-size: 2.5em;
    margin-bottom: 10px;
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1em;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.curve-type {
    display: flex;
    gap: 10px;
    align-items: center;
}

.curve-type label {
    font-weight: 600;
    color: var(--text-primary);
}

.curve-type select {
    padding: 8px 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.3s;
}

.curve-type select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.options {
    display: flex;
    align-items: center;
    gap: 20px;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary));
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.switch-label {
    font-weight: 600;
    color: var(--text-primary);
}

.buttons {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow);
}

.graph-container {
    position: relative;
    margin-bottom: 20px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px var(--shadow);
}

#graphCanvas {
    display: block;
    background: var(--canvas-bg);
    cursor: crosshair;
    width: 100%;
    height: 500px;
}

.equation-display {
    background: linear-gradient(45deg, var(--bg-secondary), var(--bg-tertiary));
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 20px;
}

.equation-display h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.3em;
}

.equation {
    font-size: 1.5em;
    font-weight: 600;
    color: var(--accent-primary);
    font-family: 'Courier New', monospace;
    background: var(--bg-primary);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow);
    word-wrap: break-word;
}

.instructions {
    background: var(--instruction-bg);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid var(--instruction-border);
}

.instructions h4 {
    color: var(--accent-primary);
    margin-bottom: 8px;
}

.instructions ul {
    color: var(--instruction-text);
    padding-left: 20px;
}

.instructions li {
    margin-bottom: 5px;
}

.point-info {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.point-card {
    background: var(--bg-primary);
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow);
    min-width: 120px;
    text-align: center;
}

.point-card h5 {
    color: var(--accent-primary);
    margin-bottom: 5px;
}

.point-card p {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--text-primary);
}

.warning {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    color: var(--warning-text);
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 0.9em;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .options {
        justify-content: center;
    }
    
    .buttons {
        justify-content: center;
    }
}