* {
    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, #0f172a 0%, #1e293b 100%);
    color: #e2e8f0;
    min-height: 100vh;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1rem;
    color: #94a3b8;
}

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

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

.animation-panel {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.canvas-container {
    background: #0f172a;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

#tidesCanvas {
    width: 100%;
    height: auto;
    display: block;
}

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

.info-item {
    background: rgba(15, 23, 42, 0.5);
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.info-item span:first-child {
    color: #94a3b8;
    font-size: 0.85rem;
}

.info-item span:last-child {
    color: #f1f5f9;
    font-weight: 600;
    margin-left: 5px;
}

.legend-section {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 8px;
    padding: 15px;
}

.legend-section h4 {
    font-size: 0.9rem;
    color: #f1f5f9;
    margin-bottom: 12px;
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #94a3b8;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-color.earth {
    background: #3b82f6;
}

.legend-color.ocean {
    background: rgba(59, 130, 246, 0.5);
}

.legend-color.moon {
    background: #e2e8f0;
}

.legend-color.sun {
    background: #fbbf24;
}

.legend-color.high-tide {
    background: #ef4444;
}

.legend-color.low-tide {
    background: #3b82f6;
}

.controls-panel {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    max-height: fit-content;
}

.controls-panel h3 {
    font-size: 1.2rem;
    color: #f1f5f9;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.control-group {
    margin-bottom: 25px;
}

.control-group h4 {
    font-size: 0.95rem;
    color: #cbd5e1;
    margin-bottom: 12px;
    font-weight: 600;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 5px;
}

.control-group label span:last-child {
    color: #f1f5f9;
    font-weight: 600;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(51, 65, 85, 0.8);
    border-radius: 3px;
    outline: none;
    margin-bottom: 15px;
    -webkit-appearance: none;
}

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

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

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

.control-group input[type="range"]::-moz-range-thumb:hover {
    background: #60a5fa;
}

.control-group select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    color: #f1f5f9;
    font-size: 0.9rem;
    margin-bottom: 15px;
    cursor: pointer;
}

.control-group select:focus {
    outline: none;
    border-color: #3b82f6;
}

.checkbox-input {
    width: auto !important;
    margin-right: 8px;
    cursor: pointer;
}

.checkbox-input + span {
    cursor: pointer;
}

.preset-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.preset-button {
    padding: 10px 12px;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 6px;
    color: #f1f5f9;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-button:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: #60a5fa;
}

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

.control-button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.control-button.start {
    background: #22c55e;
    color: #f1f5f9;
}

.control-button.start:hover {
    background: #16a34a;
}

.control-button.pause {
    background: #eab308;
    color: #1e293b;
}

.control-button.pause:hover {
    background: #ca8a04;
}

.control-button.reset {
    background: #64748b;
    color: #f1f5f9;
}

.control-button.reset:hover {
    background: #475569;
}

.formulas-section {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 8px;
    padding: 15px;
}

.formulas-section h3 {
    font-size: 1rem;
    color: #f1f5f9;
    margin-bottom: 12px;
}

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

.formula-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.formula-label {
    font-size: 0.8rem;
    color: #94a3b8;
}

.formula {
    font-size: 0.85rem;
    color: #cbd5e1;
    font-family: 'Courier New', monospace;
}

.explanation {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.explanation h2 {
    font-size: 1.5rem;
    color: #f1f5f9;
    margin-bottom: 15px;
}

.explanation h3 {
    font-size: 1.2rem;
    color: #cbd5e1;
    margin-top: 20px;
    margin-bottom: 10px;
}

.explanation p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #94a3b8;
    margin-bottom: 15px;
}

.explanation strong {
    color: #cbd5e1;
    font-weight: 600;
}
