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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

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

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

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

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
    max-width: 800px;
    margin: 0 auto;
}

main {
    padding: 40px;
}

/* Phenomenon Selection */
.phenomenon-selector {
    margin-bottom: 30px;
}

.phenomenon-selector h3 {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 15px;
}

.phenomenon-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.phenomenon-btn {
    padding: 12px 24px;
    background: #f0f0f0;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
    font-weight: 500;
}

.phenomenon-btn:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.phenomenon-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

/* Canvas Wrapper */
.canvas-wrapper {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    margin-bottom: 30px;
}

.canvas-container {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#surfaceCanvas {
    width: 100%;
    height: 600px;
    display: block;
}

/* Info Panel */
.tension-info-panel {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 15px;
    padding: 25px;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.tension-info-panel h4 {
    font-size: 1.2em;
    margin-bottom: 20px;
    font-weight: 600;
}

.tension-stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row span:first-child {
    font-size: 0.95em;
    opacity: 0.9;
}

.stat-row span:last-child {
    font-size: 1.3em;
    font-weight: 700;
}

/* Liquid Details */
.liquid-details {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.liquid-details h3 {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 20px;
}

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

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-label {
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

.detail-value {
    font-size: 1.2em;
    color: #333;
    font-weight: 600;
}

/* Controls Panel */
.controls-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.controls-panel h3 {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 25px;
}

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

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-group label {
    font-size: 0.95em;
    color: #333;
    font-weight: 500;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -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(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.control-group select {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.control-group select:focus {
    outline: none;
    border-color: #667eea;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
    color: #666;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

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

.control-button.start {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

.control-button.pause {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
}

.control-button.reset {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
}

.control-button.toggle {
    background: #e0e0e0;
    color: #333;
}

.control-button.toggle.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.control-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.control-button:active {
    transform: translateY(0);
}

/* Toggle Options */
.toggle-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95em;
    color: #333;
}

.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Formulas Section */
.formulas-section {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.formulas-section h3 {
    font-size: 1.3em;
    color: white;
    margin-bottom: 20px;
}

.formula-list {
    display: grid;
    gap: 15px;
}

.formula-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.formula-label {
    font-size: 0.95em;
    color: white;
    font-weight: 500;
}

.formula {
    font-size: 1.1em;
    color: white;
    font-weight: 600;
    font-family: 'Times New Roman', serif;
    font-style: italic;
}

/* Explanation Section */
.explanation {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.explanation h2 {
    font-size: 2em;
    color: #333;
    margin-bottom: 20px;
}

.explanation h3 {
    font-size: 1.5em;
    color: #667eea;
    margin-top: 30px;
    margin-bottom: 15px;
}

.explanation p {
    font-size: 1.05em;
    line-height: 1.8;
    color: #555;
    margin-bottom: 15px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .canvas-wrapper {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 768px) {
    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 1.8em;
    }

    main {
        padding: 20px;
    }

    .phenomenon-options {
        flex-direction: column;
    }

    .phenomenon-btn {
        width: 100%;
    }

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

    .control-button {
        width: 100%;
    }

    #surfaceCanvas {
        height: 400px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5em;
    }

    .subtitle {
        font-size: 0.9em;
    }

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

    .formula-item {
        flex-direction: column;
        align-items: flex-start;
    }
}
