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

:root {
    --primary-color: #2c3e50;
    --accent-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #e74c3c;
    --bg-color: #ecf0f1;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --border-color: #bdc3c7;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-color);
}

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

/* Header */
header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 1100px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Clocks Section */
.clocks-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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

.clock-container {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.clock-container h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1em;
    text-align: center;
}

.clock-canvas {
    width: 100%;
    height: 250px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: #fafafa;
}

.clock-info {
    margin-top: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

/* Right Section */
.right-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Photon Clock Card */
.photon-clock-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.photon-clock-card h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1em;
    text-align: center;
}

.photon-canvas {
    width: 100%;
    height: 200px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: #fafafa;
}

/* Control Card */
.control-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.control-card h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1em;
}

/* Animation Buttons */
.animation-buttons {
    display: flex;
    gap: 10px;
}

.control-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s;
    background: var(--accent-color);
    color: white;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.4);
}

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

.control-item {
    margin-bottom: 15px;
}

.control-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 500;
}

.value-display {
    background: var(--accent-color);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: 600;
    min-width: 70px;
    text-align: center;
}

/* Range Slider */
input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-color);
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
}

/* Stats */
.stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.95em;
}

.stat-row span:first-child {
    font-weight: 500;
    color: var(--primary-color);
}

.stat-row span:last-child {
    font-weight: 700;
    color: var(--accent-color);
    font-size: 1.1em;
}

/* Graph Section */
.graph-section {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.graph-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1em;
}

.graph-canvas {
    width: 100%;
    height: 300px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: #fafafa;
}

/* Formula Section */
.formula-section {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.formula-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1em;
}

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

.formula-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
}

.formula-item span {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--primary-color);
    font-size: 0.9em;
}

.formula-item code {
    background: white;
    padding: 8px 12px;
    border-radius: 5px;
    display: block;
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
    color: var(--accent-color);
    border: 1px solid var(--border-color);
}

/* Explanation Section */
.explanation {
    padding: 30px;
    background: #fafafa;
    border-top: 1px solid #e5e7eb;
    border-radius: 15px;
}

.explanation h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 15px;
}

.explanation h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #0369a1;
    margin: 20px 0 10px;
}

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

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

    .subtitle {
        font-size: 1em;
    }

    .clock-canvas,
    .photon-canvas {
        height: 200px;
    }

    .graph-canvas {
        height: 250px;
    }

    .formula-list {
        grid-template-columns: 1fr;
    }
}
