/* === Color Palette === */
:root {
    --gold: #D4AF37;
    --gold-light: #F4D03F;
    --gold-dark: #B8860B;
    --dark-bg: #0A0A0A;
    --dark-panel: #151515;
    --dark-card: #1A1A1A;
    --text-primary: #E8E8E8;
    --text-secondary: #B0B0B0;
    --accent-blue: #4A9EFF;
}

/* === Base Styles === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Source Code Pro', 'Consolas', 'Monaco', monospace;
    font-weight: 500;
    background: var(--dark-bg);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
}

/* Back Button */
.back-button {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 1000;
    background: linear-gradient(135deg, rgba(15, 15, 32, 0.9) 0%, rgba(10, 10, 24, 0.85) 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    padding: 0.8rem 1.5rem;
    color: #F4D03F;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.back-button:hover {
    border-color: rgba(212, 175, 55, 0.6);
    box-shadow: 0 6px 25px rgba(212, 175, 55, 0.25);
    transform: translateX(-4px);
    color: #D4AF37;
}

.back-button::before {
    content: '←';
    font-size: 1.2rem;
}

/* === Particle Background === */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.3;
}

/* === Header === */
.main-header {
    text-align: center;
    padding: 60px 20px 40px;
    background: linear-gradient(180deg, var(--dark-panel) 0%, transparent 100%);
}

.glitch-text {
    font-size: 4rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 8px;
    margin-bottom: 20px;
    text-shadow: 
        0 0 10px rgba(212, 175, 55, 0.5),
        0 0 20px rgba(212, 175, 55, 0.3);
}

.subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 2px;
}

.header-divider {
    width: 200px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    margin: 30px auto;
}

/* === Container === */
#container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* === Canvas Container === */
.canvas-container {
    position: relative;
    width: 100%;
    height: 70vh;
    min-height: 500px;
    background: var(--dark-card);
    border: 2px solid var(--gold-dark);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 
        0 0 30px rgba(212, 175, 55, 0.2),
        inset 0 0 50px rgba(0, 0, 0, 0.5);
    margin-bottom: 40px;
}

#epicycles-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* === Controls Panel === */
.controls-panel {
    background: var(--dark-panel);
    border: 1px solid var(--gold-dark);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

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

.control-group label {
    display: block;
    color: var(--gold-light);
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.control-group span {
    color: var(--accent-blue);
    font-weight: 700;
}

.control-group input[type="range"] {
    width: 100%;
    height: 8px;
    background: var(--dark-card);
    border-radius: 4px;
    outline: none;
    border: 1px solid var(--gold-dark);
    -webkit-appearance: none;
    appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--gold);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
    transition: all 0.2s ease;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--gold);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--gold-light);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.8);
    transform: scale(1.2);
}

.control-group select {
    width: 100%;
    padding: 12px;
    background: var(--dark-card);
    color: var(--text-primary);
    border: 1px solid var(--gold-dark);
    border-radius: 6px;
    font-family: 'Source Code Pro', monospace;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-group select:hover,
.control-group select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
    outline: none;
}

/* === Button Group === */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn-gold,
.btn-outline {
    padding: 12px 30px;
    font-family: 'Source Code Pro', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: var(--dark-bg);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(212, 175, 55, 0.6);
}

.btn-outline {
    background: transparent;
    color: var(--gold);
    border: 2px solid var(--gold);
}

.btn-outline:hover {
    background: var(--gold);
    color: var(--dark-bg);
    transform: translateY(-2px);
}

/* === Info Panel === */
.info-panel {
    background: var(--dark-panel);
    border: 1px solid var(--gold-dark);
    border-radius: 12px;
    padding: 40px;
    margin-bottom: 40px;
}

.info-panel h2 {
    color: var(--gold);
    font-size: 2rem;
    margin-bottom: 20px;
}

.info-panel p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 20px;
    line-height: 1.8;
}

.info-panel ul {
    list-style: none;
    padding-left: 0;
}

.info-panel li {
    color: var(--text-primary);
    font-size: 1.05rem;
    margin-bottom: 15px;
    padding-left: 25px;
    position: relative;
}

.info-panel li::before {
    content: "▸";
    color: var(--gold);
    position: absolute;
    left: 0;
    font-size: 1.2rem;
}

.info-panel strong {
    color: var(--gold-light);
}

.info-panel .highlight {
    color: var(--accent-blue);
    font-weight: 600;
    font-size: 1.15rem;
    margin-top: 20px;
}

/* === Math Panel === */
.math-panel {
    background: var(--dark-panel);
    border: 1px solid var(--gold-dark);
    border-radius: 12px;
    padding: 40px;
    margin-bottom: 40px;
}

.math-panel h2 {
    color: var(--gold);
    font-size: 2rem;
    margin-bottom: 30px;
    text-align: center;
}

.formula-box {
    background: rgba(26, 26, 26, 0.8);
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 2px solid var(--gold-dark);
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.formula-box:hover {
    border-color: var(--gold);
    box-shadow: 0 8px 30px rgba(212, 175, 55, 0.2);
}

.formula-box > p:first-child {
    color: var(--gold-light);
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.math-display {
    background: rgba(0, 0, 0, 0.4);
    padding: 25px;
    border-radius: 6px;
    margin: 20px 0;
    font-size: 1.4rem;
    line-height: 2;
    overflow-x: auto;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.math-note {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-style: italic;
    margin-top: 15px;
}

/* KaTeX styling */
.katex {
    font-size: 1.2em !important;
    color: #E8E8E8 !important;
}

.katex * {
    color: inherit !important;
}

/* === Responsive === */
@media (max-width: 768px) {
    .glitch-text {
        font-size: 2.5rem;
        letter-spacing: 4px;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }
    
    .canvas-container {
        height: 50vh;
        min-height: 400px;
    }
    
    .controls-panel,
    .info-panel,
    .math-panel {
        padding: 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn-gold,
    .btn-outline {
        width: 100%;
    }
}
