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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    background: #0f0f23;
    display: flex;
    height: 100vh;
    gap: 20px;
    padding: 20px;
}

/* Navigation Buttons */
.back-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #60a5fa;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.back-button:hover {
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.3);
    transform: translateY(-2px);
}

.next-simulation-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    padding: 12px 24px;
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 12px;
    color: #a78bfa;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.next-simulation-button:hover {
    background: rgba(167, 139, 250, 0.2);
    border-color: rgba(167, 139, 250, 0.5);
    transform: translateY(-2px);
}

/* Left Sidebar */
.sidebar-left {
    width: 340px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-left::-webkit-scrollbar {
    width: 6px;
}

.sidebar-left::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.sidebar-left::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.sidebar-left::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

#canvas-container {
    flex: 1;
    position: relative;
    background: linear-gradient(135deg, #1e2a3a 0%, #1a2332 100%);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

#canvas-container canvas {
    border-radius: 24px;
}

/* Right Sidebar */
.sidebar-right {
    width: 340px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-right::-webkit-scrollbar {
    width: 6px;
}

.sidebar-right::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.sidebar-right::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.sidebar-right::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Info Panel */
.info-panel {
    background: rgba(255, 255, 255, 0.03);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    padding: 24px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.info-panel h1 {
    text-align: left;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.calculations {
    font-size: 15px;
    color: #a0a0a0;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin: 0;
    border-radius: 12px;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.02);
    gap: 12px;
}

.calc-row:hover {
    background: rgba(96, 165, 250, 0.1);
    transform: translateX(4px);
}

.calc-row.highlight {
    background: rgba(167, 139, 250, 0.1);
    font-weight: 500;
}

.calc-label {
    color: #d0d0d0;
    font-weight: 400;
    flex-shrink: 0;
    min-width: 120px;
}

.calc-value {
    color: #60a5fa;
    font-weight: 600;
    font-feature-settings: 'tnum';
    text-shadow: 0 0 20px rgba(96, 165, 250, 0.3);
    text-align: right;
    flex-shrink: 0;
}

.calc-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    margin: 12px 0;
}

/* Controls Panel */
.controls-panel {
    background: rgba(255, 255, 255, 0.03);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    padding: 24px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.panel-title {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #a78bfa 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

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

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #d0d0d0;
}

.control-label {
    font-weight: 500;
    color: #d0d0d0;
}

.control-value {
    color: #60a5fa;
    font-weight: 600;
    font-feature-settings: 'tnum';
    background: rgba(96, 165, 250, 0.15);
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 14px;
    text-shadow: 0 0 20px rgba(96, 165, 250, 0.3);
    border: 1px solid rgba(96, 165, 250, 0.2);
}

input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

input[type="range"]:hover {
    background: rgba(255, 255, 255, 0.12);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    box-shadow: 
        0 4px 12px rgba(96, 165, 250, 0.4),
        0 0 0 3px rgba(96, 165, 250, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 
        0 6px 16px rgba(96, 165, 250, 0.5),
        0 0 0 4px rgba(96, 165, 250, 0.3),
        0 0 20px rgba(96, 165, 250, 0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    box-shadow: 
        0 4px 12px rgba(96, 165, 250, 0.4),
        0 0 0 3px rgba(96, 165, 250, 0.2);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 
        0 6px 16px rgba(96, 165, 250, 0.5),
        0 0 0 4px rgba(96, 165, 250, 0.3),
        0 0 20px rgba(96, 165, 250, 0.4);
}

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

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
    color: #d0d0d0;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.checkbox-label:hover {
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.2);
}

.checkbox-text {
    -webkit-user-select: none;
    user-select: none;
}

.checkbox-group input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #60a5fa;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 0;
}

.btn {
    width: 100%;
    padding: 14px 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    background: rgba(255, 255, 255, 0.05);
    color: #d0d0d0;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    border-color: rgba(96, 165, 250, 0.4);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

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

.btn-icon {
    display: none;
}

.btn-shoot {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 20px rgba(96, 165, 250, 0.4);
}

.btn-shoot:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    box-shadow: 0 8px 30px rgba(96, 165, 250, 0.6);
    transform: translateY(-3px);
}

.btn-reset {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-reset:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

.btn-theory {
    background: rgba(167, 139, 250, 0.1);
    color: #c4b5fd;
    border-color: rgba(167, 139, 250, 0.3);
}

.btn-theory:hover {
    background: rgba(167, 139, 250, 0.2);
    border-color: rgba(167, 139, 250, 0.5);
    box-shadow: 0 8px 20px rgba(167, 139, 250, 0.3);
}

.instruction {
    display: none;
}

.instruction-icon {
    display: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    margin: 5% auto;
    padding: 40px;
    border-radius: 24px;
    width: 85%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideInUp 0.4s ease-out;
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(96, 165, 250, 0.3);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(96, 165, 250, 0.5);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    color: #9ca3af;
    float: right;
    font-size: 32px;
    font-weight: 300;
    cursor: pointer;
    line-height: 24px;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.close:hover {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.15);
    transform: rotate(90deg);
}

.modal-content h2 {
    margin-bottom: 28px;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    font-size: 28px;
    clear: both;
}

.theory-content h3 {
    margin-top: 24px;
    margin-bottom: 14px;
    color: #c4b5fd;
    font-weight: 600;
    font-size: 18px;
}

.theory-content p {
    margin: 12px 0;
    line-height: 1.8;
    color: #d0d0d0;
    font-size: 15px;
}

.theory-content strong {
    color: #60a5fa;
    font-weight: 600;
}

.theory-content ul {
    margin-left: 24px;
    margin-top: 14px;
}

.theory-content li {
    margin: 10px 0;
    color: #d0d0d0;
    line-height: 1.7;
}

/* Formula styling for KaTeX */
.theory-content .formula {
    background: rgba(96, 165, 250, 0.08);
    border-left: 3px solid #60a5fa;
    padding: 16px 20px;
    margin: 16px 0;
    border-radius: 8px;
    overflow-x: auto;
}

.theory-content .katex {
    font-size: 1.15em;
    color: #e0e0e0;
}

.theory-content .katex-display {
    margin: 0;
}

.theory-content .formula-explanation {
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 1400px) {
    body {
        flex-direction: column;
        padding: 16px;
        gap: 16px;
    }
    
    .sidebar-left,
    .sidebar-right {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 16px;
    }
    
    #canvas-container {
        height: 50vh;
        min-height: 400px;
        order: -1;
    }
    
    .info-panel,
    .controls-panel {
        min-width: 320px;
        flex-shrink: 0;
    }
}

@media (max-width: 768px) {
    body {
        padding: 12px;
        gap: 12px;
    }
    
    #canvas-container {
        border-radius: 16px;
        height: 45vh;
        min-height: 300px;
    }
    
    .sidebar-left,
    .sidebar-right {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    .info-panel,
    .controls-panel {
        min-width: auto;
        width: 100%;
    }
    
    .button-group {
        flex-direction: column;
    }
}
