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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
    color: #ffffff;
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==================== HEADER ==================== */
.header {
    background: linear-gradient(135deg, #1a1a2e 0%, #2a2a3e 100%);
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    position: relative;
}

.header-content {
    text-align: center;
    margin-bottom: 1rem;
}

.title {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #FF6B35 0%, #00D9FF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #00D9FF;
    font-size: 1rem;
    opacity: 0.8;
}

.mode-switcher {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #2a2a3e;
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.mode-btn:hover {
    background: rgba(255, 107, 53, 0.2);
    border-color: #FF6B35;
    transform: translateY(-2px);
}

.mode-btn.active {
    background: linear-gradient(135deg, #FF6B35 0%, #FF69B4 100%);
    border-color: #FF6B35;
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.6);
}

.mode-icon {
    font-size: 1.2rem;
}

.help-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 217, 255, 0.2);
    border: 2px solid #00D9FF;
    color: #00D9FF;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.help-btn:hover {
    background: #00D9FF;
    color: #0a0a0a;
    transform: scale(1.05);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    display: flex;
    position: relative;
    max-height: calc(100vh - 350px);
}

.canvas-container {
    flex: 1;
    position: relative;
    background: #0a0a0a;
    border: 2px solid #2a2a3e;
    margin: 1rem;
    border-radius: 10px;
    overflow: hidden;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ==================== INFO PANEL ==================== */
.info-panel {
    width: 300px;
    background: rgba(26, 26, 46, 0.95);
    border-left: 2px solid #2a2a3e;
    padding: 1.5rem;
    overflow-y: auto;
    position: relative;
    transition: transform 0.3s ease;
}

.info-panel.collapsed {
    transform: translateX(100%);
}

.info-toggle {
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(26, 26, 46, 0.95);
    border: 2px solid #2a2a3e;
    border-right: none;
    color: #00D9FF;
    padding: 1rem 0.5rem;
    cursor: pointer;
    border-radius: 5px 0 0 5px;
    font-size: 1rem;
}

.info-content h3 {
    color: #FF6B35;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.math-display {
    background: rgba(0, 217, 255, 0.1);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-size: 1.1rem;
    color: #00D9FF;
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
}

.info-values {
    margin-bottom: 1.5rem;
}

.value-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 0.5rem;
    border-radius: 5px;
}

.value-label {
    color: #00D9FF;
}

.value-data {
    color: #FF6B35;
    font-weight: bold;
}

.tips h4 {
    color: #FFD700;
    margin-bottom: 0.5rem;
}

.tips p {
    color: #ffffff;
    opacity: 0.8;
    line-height: 1.5;
}

/* ==================== CONTROL PANEL ==================== */
.control-panel {
    background: linear-gradient(135deg, #1a1a2e 0%, #2a2a3e 100%);
    padding: 1.5rem;
    border-top: 2px solid #2a2a3e;
}

.controls-section {
    max-width: 1200px;
    margin: 0 auto;
}

.slider-group {
    margin-bottom: 1rem;
}

.slider-group label {
    display: block;
    color: #00D9FF;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

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

.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #FF6B35 0%, #FF69B4 100%);
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.6);
}

.slider-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #FF6B35 0%, #FF69B4 100%);
    cursor: pointer;
    border-radius: 50%;
    border: none;
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.6);
}

.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #2a2a3e;
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    flex: 1;
    min-width: 120px;
}

.control-btn:hover {
    background: rgba(0, 217, 255, 0.2);
    border-color: #00D9FF;
    transform: translateY(-2px);
}

.berry-btn {
    background: linear-gradient(135deg, #FF69B4 0%, #FF6B35 100%);
    border-color: #FF69B4;
}

.berry-btn:hover {
    box-shadow: 0 0 20px rgba(255, 105, 180, 0.6);
}

.series-info {
    background: rgba(0, 217, 255, 0.1);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.series-formula {
    text-align: center;
    font-size: 1.2rem;
    color: #00D9FF;
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
}

.series-stats {
    display: flex;
    justify-content: space-around;
    color: #ffffff;
}

.series-stats strong {
    color: #FF6B35;
}

/* ==================== SANDBOX TOOLS ==================== */
.tool-palette h4 {
    color: #00D9FF;
    margin-bottom: 0.5rem;
}

.symbol-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.symbol-btn {
    background: rgba(0, 217, 255, 0.2);
    border: 2px solid #00D9FF;
    color: #00D9FF;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.symbol-btn:hover {
    background: #00D9FF;
    color: #0a0a0a;
    transform: scale(1.1);
}

/* ==================== MODAL ==================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #2a2a3e 100%);
    padding: 2rem;
    border-radius: 15px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    border: 2px solid #00D9FF;
    box-shadow: 0 0 40px rgba(0, 217, 255, 0.3);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: #FF6B35;
    transition: all 0.3s ease;
}

.modal-close:hover {
    color: #FF69B4;
    transform: scale(1.2);
}

.modal-content h2 {
    color: #FF6B35;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.help-section {
    margin-bottom: 1.5rem;
}

.help-section h3 {
    color: #00D9FF;
    margin-bottom: 0.5rem;
}

.help-section p {
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.help-section ul {
    margin-left: 1.5rem;
    line-height: 1.8;
}

.euler-formula {
    background: rgba(0, 217, 255, 0.1);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-size: 1.5rem;
    color: #00D9FF;
    font-family: 'Courier New', monospace;
    margin: 1rem 0;
}

.inspired {
    text-align: center;
    color: #FFD700;
    margin-top: 1rem;
    font-style: italic;
}

/* ==================== FOOTER ==================== */
.footer {
    background: #1a1a2e;
    padding: 1.5rem;
    text-align: center;
    border-top: 2px solid #2a2a3e;
}

.footer p {
    margin: 0.5rem 0;
    color: #ffffff;
    opacity: 0.8;
}

.footer a {
    color: #FF6B35;
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer a:hover {
    color: #FF69B4;
    text-decoration: underline;
}

.credit {
    font-size: 0.9rem;
    color: #00D9FF;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .info-panel {
        position: absolute;
        right: 0;
        top: 0;
        height: 100%;
        z-index: 10;
    }
}

@media (max-width: 768px) {
    .title {
        font-size: 1.8rem;
    }
    
    .mode-switcher {
        flex-direction: column;
    }
    
    .mode-btn {
        width: 100%;
    }
    
    .main-content {
        flex-direction: column;
        max-height: none;
    }
    
    .canvas-container {
        height: 400px;
    }
    
    .info-panel {
        width: 100%;
        max-height: 300px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .control-btn {
        width: 100%;
    }
    
    .symbol-buttons {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1rem;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .mode-label {
        font-size: 0.9rem;
    }
    
    .canvas-container {
        height: 300px;
        margin: 0.5rem;
    }
    
    .control-panel {
        padding: 1rem;
    }
    
    .symbol-buttons {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ==================== ANIMATIONS ==================== */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 107, 53, 0.6);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 107, 53, 1);
    }
}

.mode-btn.active {
    animation: glow 2s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.help-btn {
    animation: float 3s ease-in-out infinite;
}