* {
    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, #1e3c72 0%, #2a5298 50%, #7e22ce 100%);
    min-height: 100vh;
    padding: 20px;
}

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

header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e22ce 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

header .subtitle {
    font-size: 1.05em;
    opacity: 0.95;
    line-height: 1.6;
}

main {
    padding: 30px;
}

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

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

.chart-display {
    background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chart-display:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.chart-display h3 {
    color: #1e3c72;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: 600;
}

.chart-display canvas {
    width: 100%;
    height: auto;
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.titration-legend,
.curve-info,
.jump-info,
.indicator-info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #333;
}

.flask-icon {
    width: 20px;
    height: 20px;
    background: linear-gradient(145deg, #a855f7, #7e22ce);
    border-radius: 4px;
    position: relative;
}

.flask-icon::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 8px;
    background: #a855f7;
}

.burette-icon {
    width: 20px;
    height: 30px;
    background: linear-gradient(145deg, #f0f0f0, #d0d0d0);
    border-radius: 3px;
    border: 2px solid #999;
    position: relative;
}

.burette-icon::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 8px solid #666;
}

.drop-icon {
    width: 8px;
    height: 8px;
    background: radial-gradient(circle at 30% 30%, #3b82f6, #1e40af);
    border-radius: 50%;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    color: #555;
    font-weight: 500;
}

.color-box {
    width: 30px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid #ccc;
    display: inline-block;
}

.controls-panel {
    background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.controls-panel h3 {
    color: #1e3c72;
    margin-bottom: 20px;
    font-size: 1.4em;
    font-weight: 600;
}

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

.control-group {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.control-group h4 {
    color: #2a5298;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 600;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-size: 0.95em;
    font-weight: 500;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, #1e3c72, #7e22ce);
    outline: none;
    margin-bottom: 5px;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(145deg, #a855f7, #7e22ce);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(145deg, #a855f7, #7e22ce);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.control-group select,
.control-group input[type="color"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 0.95em;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.control-group input[type="color"] {
    height: 40px;
    padding: 2px;
}

.control-group select:focus {
    outline: none;
    border-color: #7e22ce;
}

.slider-hint {
    font-size: 0.8em;
    color: #888;
    margin-bottom: 15px;
    font-style: italic;
}

.preset-btn,
.anim-btn {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 10px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(145deg, #1e3c72, #2a5298);
    color: white;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-btn:hover,
.anim-btn:hover {
    background: linear-gradient(145deg, #2a5298, #7e22ce);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 60, 114, 0.3);
}

.preset-btn:active,
.anim-btn:active {
    transform: translateY(0);
}

.formulas-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.formulas-section h3 {
    color: #1e3c72;
    margin-bottom: 20px;
    font-size: 1.3em;
    font-weight: 600;
}

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

.formula-item {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border-left: 4px solid #7e22ce;
}

.formula-label {
    font-weight: 600;
    color: #2a5298;
    min-width: 150px;
    font-size: 0.9em;
}

.formula {
    color: #333;
    font-family: 'Times New Roman', serif;
    font-size: 1.05em;
}

.explanation {
    background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px;
    border-radius: 16px;
    margin-top: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.explanation h2 {
    color: #1e3c72;
    margin-bottom: 20px;
    font-size: 1.8em;
    font-weight: 700;
}

.explanation h3 {
    color: #2a5298;
    margin-top: 25px;
    margin-bottom: 12px;
    font-size: 1.3em;
    font-weight: 600;
}

.explanation p {
    color: #444;
    line-height: 1.8;
    margin-bottom: 15px;
}

.explanation strong {
    color: #1e3c72;
}

/* Animation effects */
@keyframes dropFall {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(50px);
        opacity: 0;
    }
}

@keyframes colorChange {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    header .subtitle {
        font-size: 0.95em;
    }

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

    .formula-item {
        flex-direction: column;
    }

    .formula-label {
        min-width: auto;
    }
}
