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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #e2e8f0;
    min-height: 100vh;
    padding: 20px;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

header h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #60a5fa 0%, #34d399 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

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

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

/* Panels */
.panel {
    background: rgba(30, 41, 59, 0.7);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
}

.panel h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #3b82f6;
    border-bottom: 2px solid rgba(59, 130, 246, 0.3);
    padding-bottom: 10px;
}

/* Canvas Container */
.canvas-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 600px;
}

#simulationCanvas {
    border: 2px solid rgba(59, 130, 246, 0.5);
    border-radius: 8px;
    cursor: crosshair;
    background: linear-gradient(180deg, #0a1628 0%, #1a2744 100%);
}

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

.control-group label {
    display: block;
    font-size: 0.9rem;
    color: #94a3b8;
    margin-bottom: 8px;
    font-weight: 500;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(148, 163, 184, 0.3);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    border: none;
}

.value-display {
    float: right;
    font-family: 'Courier New', monospace;
    color: #06b6d4;
    font-weight: 600;
}

input[type="number"],
input[type="text"],
select {
    width: 100%;
    padding: 10px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    color: #f8fafc;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
}

input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

/* Buttons */
button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: rgba(148, 163, 184, 0.3);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* Checkboxes */
.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #3b82f6;
}

/* Stats Display */
.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border-left: 3px solid #3b82f6;
}

.stat-label {
    color: #94a3b8;
    font-size: 0.9rem;
}

.stat-value {
    font-family: 'Courier New', monospace;
    color: #06b6d4;
    font-weight: 600;
    font-size: 0.95rem;
}

/* Convergence Section */
.convergence-section {
    grid-column: 1 / -1;
    margin-top: 20px;
}

#convergenceResults {
    margin-top: 20px;
    display: none;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.results-table th,
.results-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.results-table th {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    font-weight: 600;
}

.results-table td {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.results-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    color: #3b82f6;
    margin-left: 5px;
}

.tooltip:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

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

    .canvas-container {
        order: -1;
    }
}

/* Animation for particles */
@keyframes particleFall {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.collision-marker {
    animation: pulse 0.5s ease-out;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.5);
    }
}