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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3a5f 0%, #0d1b2a 100%);
    color: #ffffff;
    line-height: 1.6;
    min-height: 100vh;
}

.thermoelectric-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1em;
}

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

.effect-panel,
.analysis-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.effect-selector {
    margin-bottom: 20px;
}

.effect-selector h3 {
    margin-bottom: 10px;
    color: #667eea;
}

.effect-btn {
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.5);
    color: white;
    padding: 10px 15px;
    margin: 5px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.effect-btn:hover {
    background: rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.effect-btn.active {
    background: rgba(102, 126, 234, 0.6);
    border-color: #667eea;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
}

.thermocouple-display,
.temperature-display,
.electrical-display,
.heat-flow-display,
.material-display {
    margin-bottom: 20px;
}

.thermocouple-display h3,
.temperature-display h3,
.electrical-display h3,
.heat-flow-display h3,
.material-display h3 {
    margin-bottom: 10px;
    color: #764ba2;
    font-size: 1.1em;
}

canvas {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    height: 250px;
}

.material-labels {
    position: relative;
    height: 30px;
    margin-top: 10px;
}

.material-label {
    position: absolute;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85em;
    text-align: center;
}

.material-label span {
    display: block;
}

.property-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.property-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.property-label {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
}

.property-value {
    font-weight: bold;
    color: #10b981;
    font-size: 1.1em;
}

.controls-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

.controls-panel h3 {
    margin-bottom: 20px;
    color: #667eea;
}

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

.control-group {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
}

.control-group h4 {
    margin-bottom: 15px;
    color: #764ba2;
    font-size: 1em;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9em;
}

.control-group input[type="range"] {
    width: 100%;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.control-group select {
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    color: white;
    font-size: 0.9em;
}

.control-group select option {
    background: #1e3a5f;
    color: white;
}

.checkbox-input {
    margin-right: 8px;
}

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

.control-button {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.control-button.start {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.control-button.start:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4);
}

.control-button.pause {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.control-button.pause:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 158, 11, 0.4);
}

.control-button.reset {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.control-button.reset:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.4);
}

.preset-btn {
    background: rgba(118, 75, 162, 0.3);
    border: 1px solid rgba(118, 75, 162, 0.5);
    color: white;
    padding: 8px 12px;
    margin: 3px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85em;
    width: calc(50% - 6px);
}

.preset-btn:hover {
    background: rgba(118, 75, 162, 0.5);
    transform: translateY(-2px);
}

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

.formulas-section h3 {
    margin-bottom: 15px;
    color: #667eea;
}

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

.formula-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.formula-label {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
}

.formula {
    font-family: 'Courier New', monospace;
    color: #10b981;
    font-size: 0.95em;
}

.explanation {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 30px;
    backdrop-filter: blur(10px);
}

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

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

.explanation p {
    margin-bottom: 15px;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.8);
}

.explanation strong {
    color: #667eea;
}

.explanation ul,
.explanation ol {
    margin-left: 20px;
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.8);
}

.explanation li {
    margin-bottom: 8px;
}

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

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

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

    header h1 {
        font-size: 1.8em;
    }

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

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