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

:root {
    --primary-color: #667eea;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
}

.polymer-transition-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    margin-bottom: 30px;
}

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

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

main {
    padding: 0 20px 20px;
}

/* Polymer Selector */
.polymer-selector {
    margin-bottom: 30px;
    text-align: center;
}

.polymer-selector h3 {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: #2c3e50;
}

.polymer-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.polymer-btn {
    padding: 15px 25px;
    font-size: 1em;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.polymer-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.polymer-btn.active {
    background: var(--primary-color);
    color: white;
}

.tg-value {
    font-size: 0.85em;
    opacity: 0.9;
    font-weight: 500;
}

/* Visualization Area */
.visualization-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.vt-section,
.molecular-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.vt-section h3,
.molecular-section h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #2c3e50;
    text-align: center;
}

#vtCanvas,
#molecularCanvas {
    width: 100%;
    height: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.vt-info,
.molecular-info {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.info-item {
    margin-bottom: 8px;
    font-size: 0.95em;
}

.info-item:last-child {
    margin-bottom: 0;
}

.motion-description {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.motion-state {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1em;
    text-align: center;
}

.motion-text {
    color: #666;
    text-align: center;
    line-height: 1.5;
}

/* Modulus Section */
.modulus-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

#modulusCanvas {
    width: 100%;
    height: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modulus-info {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
}

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

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

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

.control-group {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.control-group h4 {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: #2c3e50;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
}

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

.control-group input[type="range"] {
    width: 100%;
    margin-bottom: 15px;
    height: 6px;
    border-radius: 3px;
    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: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: none;
}

.checkbox-label {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
}

.checkbox-input {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.animate-button {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.animate-button:hover {
    background: #5568d3;
}

.animate-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Property Comparison */
.property-comparison {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

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

.comparison-table {
    overflow-x: auto;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.comparison-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.comparison-table tr:hover {
    background: #f8f9fa;
}

/* Formulas Section */
.formulas-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

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

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

.formula-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
}

.formula-label {
    font-weight: 600;
    color: #2c3e50;
    margin-right: 10px;
}

.formula {
    font-family: 'Courier New', monospace;
    font-size: 1.1em;
    color: var(--primary-color);
}

/* Instructions */
.instructions {
    background: #e8f4f8;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border-left: 4px solid #17a2b8;
}

.instructions h4 {
    font-size: 1.2em;
    margin-bottom: 12px;
    color: #0c5460;
}

.instructions ul {
    list-style-position: inside;
    color: #495057;
}

.instructions li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Explanation Section */
.explanation {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.explanation h2 {
    font-size: 2em;
    margin-bottom: 20px;
    color: #2c3e50;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 10px;
}

.explanation h3 {
    font-size: 1.5em;
    margin-top: 25px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.explanation p {
    margin-bottom: 15px;
    line-height: 1.8;
    color: #495057;
    text-align: justify;
}

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

@media (max-width: 768px) {
    .polymer-transition-container {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8em;
    }

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

    .polymer-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .polymer-btn {
        width: 100%;
    }

    .comparison-table {
        font-size: 0.9em;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vt-section,
.molecular-section,
.modulus-section,
.controls-panel {
    animation: fadeIn 0.5s ease-out;
}

/* Transition Effects */
* {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Canvas Styles */
canvas {
    display: block;
    margin: 0 auto;
}

/* State-specific Styles */
.glassy-mode {
    --primary-color: #FF6B6B;
}

.rubbery-mode {
    --primary-color: #4ECDC4;
}

.transition-mode {
    --primary-color: #FFEAA7;
}
