* {
    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, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.archimedes-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, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

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

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

main {
    padding: 30px;
}

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

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

#fluidCanvas {
    width: 100%;
    height: 400px;
    border-radius: 10px;
    background: linear-gradient(180deg, #87CEEB 0%, #4A90E2 100%);
    display: block;
}

.simulation-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

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

.info-item span:first-child {
    font-weight: 600;
    color: #2c3e50;
    display: block;
    margin-bottom: 5px;
}

.info-item span:last-child {
    font-size: 1.2em;
    font-weight: 700;
    color: #3498db;
}

.info-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.formula-section, .density-section {
    margin-bottom: 25px;
}

.formula-section h3, .density-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.formula-display {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.formula-main {
    font-size: 1.4em;
    font-weight: 600;
    color: #e74c3c;
    text-align: center;
    margin-bottom: 10px;
}

.formula-sub {
    font-size: 1.1em;
    color: #34495e;
    text-align: center;
}

.density-comparison {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.density-bar {
    margin-bottom: 20px;
}

.density-bar:last-child {
    margin-bottom: 0;
}

.bar-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.bar-container {
    background: #ecf0f1;
    border-radius: 10px;
    height: 30px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    transition: width 0.3s ease;
    border-radius: 10px;
}

.bar-value {
    text-align: center;
    margin-top: 5px;
    font-weight: 600;
    color: #2c3e50;
}

.density-relationship {
    margin-top: 15px;
    padding: 15px;
    background: #e8f4f8;
    border-radius: 8px;
    font-weight: 600;
    color: #2980b9;
    text-align: center;
}

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

.controls-panel h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3em;
}

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

.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;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

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

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

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #2980b9;
}

.control-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.control-group select:focus {
    outline: none;
    border-color: #3498db;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.control-button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 120px;
}

.control-button.start {
    background: #27ae60;
    color: white;
}

.control-button.start:hover {
    background: #229954;
    transform: translateY(-2px);
}

.control-button.pause {
    background: #f39c12;
    color: white;
}

.control-button.pause:hover {
    background: #e67e22;
    transform: translateY(-2px);
}

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

.control-button.reset:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.control-button.drop {
    background: #9b59b6;
    color: white;
}

.control-button.drop:hover {
    background: #8e44ad;
    transform: translateY(-2px);
}

.calculations-section {
    margin-top: 20px;
}

.calculations-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.calc-list {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.calc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #ecf0f1;
}

.calc-item:last-child {
    border-bottom: none;
}

.calc-label {
    font-weight: 600;
    color: #2c3e50;
}

.calc-value {
    font-weight: 700;
    color: #3498db;
}

.explanation {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.explanation h3 {
    color: #34495e;
    margin-top: 25px;
    margin-bottom: 10px;
    font-size: 1.5em;
}

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

.applications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.application-item {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.application-item h4 {
    color: #3498db;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.application-item p {
    color: #555;
    line-height: 1.6;
    margin: 0;
}

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

    .simulation-info {
        grid-template-columns: 1fr;
    }

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

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

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

    main {
        padding: 15px;
    }

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

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