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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    min-height: 100vh;
    padding: 20px;
}

.hybrid-orbitals-container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    padding: 30px;
}

.visualization-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.orbitals-panel,
.formation-panel {
    background: #f9fafb;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.orbitals-panel h3,
.formation-panel h3 {
    color: #1f2937;
    font-size: 1.2rem;
    margin-bottom: 15px;
    text-align: center;
}

canvas {
    display: block;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
}

.orbitals-info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    justify-content: center;
}

.info-item {
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    font-size: 0.9rem;
}

.info-item span:first-child {
    font-weight: 600;
    color: #374151;
}

.info-item span:last-child {
    color: #7c3aed;
    font-weight: 700;
}

.formation-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid #d1d5db;
}

.legend-color.s-orbital {
    background: #ef4444;
}

.legend-color.p-orbital {
    background: #3b82f6;
}

.legend-color.hybrid {
    background: #10b981;
}

.controls-panel {
    background: #f9fafb;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.controls-panel h3 {
    color: #1f2937;
    font-size: 1.3rem;
    margin-bottom: 20px;
    text-align: center;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.control-group {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #374151;
    font-weight: 500;
}

.control-group label span:last-child {
    color: #7c3aed;
    font-weight: 700;
}

.type-selector {
    display: flex;
    gap: 10px;
}

.type-btn {
    flex: 1;
    padding: 10px;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s;
    color: #374151;
}

.type-btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.type-btn.active {
    background: #7c3aed;
    color: white;
    border-color: #6d28d9;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #7c3aed;
    cursor: pointer;
    transition: background 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #6d28d9;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #7c3aed;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

input[type="range"]::-moz-range-thumb:hover {
    background: #6d28d9;
}

.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.control-button {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.control-button.animate {
    background: #7c3aed;
    color: white;
}

.control-button.animate:hover {
    background: #6d28d9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.control-button.reset {
    background: #ef4444;
    color: white;
}

.control-button.reset:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.control-button.toggle {
    background: #10b981;
    color: white;
}

.control-button.toggle:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.molecules-section,
.formulas-section,
.options-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.molecules-section h3,
.formulas-section h3,
.options-section h3 {
    color: #1f2937;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.molecule-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.molecule-btn {
    padding: 8px 16px;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.molecule-btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

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

.formula-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f3f4f6;
    border-radius: 6px;
    flex-wrap: wrap;
    gap: 10px;
}

.formula-label {
    font-weight: 600;
    color: #374151;
}

.formula {
    font-family: 'Courier New', monospace;
    color: #7c3aed;
    font-size: 1.1rem;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #f3f4f6;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.option-item:hover {
    background: #e5e7eb;
}

.option-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #7c3aed;
}

.explanation {
    background: #f9fafb;
    padding: 30px;
    margin-top: 30px;
    border-radius: 12px;
}

.explanation h2 {
    color: #1f2937;
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.explanation h3 {
    color: #374151;
    font-size: 1.3rem;
    margin-top: 25px;
    margin-bottom: 10px;
}

.explanation p {
    color: #4b5563;
    line-height: 1.7;
    margin-bottom: 15px;
}

@media (max-width: 1024px) {
    .visualization-layout {
        grid-template-columns: 1fr;
    }

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

    header h1 {
        font-size: 1.8rem;
    }

    .button-group {
        flex-direction: column;
    }

    .control-button {
        width: 100%;
    }
}

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

    main {
        padding: 15px;
    }

    header {
        padding: 20px;
    }

    header h1 {
        font-size: 1.4rem;
    }

    .explanation {
        padding: 20px;
    }

    .orbitals-info {
        flex-direction: column;
    }

    .type-selector {
        flex-direction: column;
    }
}
