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

body {
    background: #0a0a0f;
    color: #e2e8f0;
    font-family: 'DM Sans', sans-serif;
    overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #1a1a2e; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

/* ============ ANIMATIONS ============ */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(34,197,94,0.3); }
    50% { box-shadow: 0 0 40px rgba(34,197,94,0.6); }
}
@keyframes shake {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-6px, 3px) rotate(-1deg); }
    20% { transform: translate(6px, -3px) rotate(1deg); }
    30% { transform: translate(-4px, -4px) rotate(-0.5deg); }
    40% { transform: translate(5px, 2px) rotate(0.5deg); }
    50% { transform: translate(-3px, 4px) rotate(-1deg); }
    60% { transform: translate(4px, -2px) rotate(0.5deg); }
    70% { transform: translate(-5px, 3px) rotate(-0.5deg); }
    80% { transform: translate(3px, -4px) rotate(1deg); }
    90% { transform: translate(-2px, 2px) rotate(-0.5deg); }
}
@keyframes fade-in {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in-scale {
    0% { opacity: 0; transform: scale(0.9) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes spin-slow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes glow-pulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.4); }
}
@keyframes slide-up {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes wobble {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.08) rotate(2deg); }
    50% { transform: scale(0.95) rotate(-1deg); }
    75% { transform: scale(1.05) rotate(1deg); }
}

.float { animation: float 3s ease-in-out infinite; }
.pulse-glow { animation: pulse-glow 2s ease-in-out infinite; }
.shake { animation: shake 0.5s ease-in-out; }
.fade-in { animation: fade-in 0.6s ease-out forwards; }
.fade-in-scale { animation: fade-in-scale 0.5s ease-out forwards; }
.slide-up { animation: slide-up 0.5s ease-out forwards; }
.wobble { animation: wobble 0.6s ease-in-out; }

/* ============ ATOM STYLES ============ */
.atom {
    cursor: grab;
    user-select: none;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}
.atom:hover { transform: scale(1.05); }
.atom:active, .atom.dragging {
    cursor: grabbing;
    transform: scale(1.1);
}

.atom-circle {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    position: relative;
    z-index: 2;
}

/* ============ NUCLEUS (visible protons/neutrons) ============ */
.nucleus-view {
    position: relative;
    border-radius: 50%;
}
.nucleon {
    position: absolute;
    border-radius: 50%;
    width: 8px; height: 8px;
    transition: all 0.3s;
}
.nucleon.proton { background: #ef4444; box-shadow: 0 0 4px #ef444466; }
.nucleon.neutron { background: #94a3b8; box-shadow: 0 0 4px #94a3b866; }

/* ============ ELECTRON ORBITS ============ */
.orbit {
    position: absolute;
    border: 1px dashed rgba(59, 130, 246, 0.25);
    border-radius: 50%;
    animation: spin-slow 8s linear infinite;
    pointer-events: none;
}
.orbit-electron {
    width: 6px; height: 6px;
    background: #3b82f6;
    border-radius: 50%;
    position: absolute;
    box-shadow: 0 0 8px #3b82f6;
}

/* ============ DROP ZONES ============ */
.drop-zone {
    border: 2px dashed #334155;
    border-radius: 16px;
    transition: all 0.3s;
    position: relative;
}
.drop-zone.active {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.03);
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.08);
}
.drop-zone.hover {
    border-color: #facc15;
    background: rgba(250, 204, 21, 0.06);
    box-shadow: inset 0 0 60px rgba(250, 204, 21, 0.05), 0 0 40px rgba(250, 204, 21, 0.12);
}
.drop-zone.drop-success {
    border-color: #22c55e;
    box-shadow: inset 0 0 80px rgba(34, 197, 94, 0.1);
}

/* ============ PARTICLE CANVAS ============ */
#particle-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 100;
}

/* ============ CARDS ============ */
.info-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 1px solid #1e293b;
    border-radius: 12px;
    transition: all 0.3s;
}
.info-card:hover {
    border-color: #334155;
    transform: translateY(-2px);
}

.level-card {
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    overflow: hidden;
    position: relative;
}
.level-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(34,197,94,0.08), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}
.level-card:hover::before { opacity: 1; }
.level-card:hover {
    border-color: #22c55e;
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(34, 197, 94, 0.15);
}
.level-card .level-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

/* ============ RESULT PANEL ============ */
.result-panel {
    background: linear-gradient(135deg, rgba(34,197,94,0.1), rgba(250,204,21,0.05));
    border: 1px solid rgba(34,197,94,0.3);
    border-radius: 12px;
}

/* ============ ENERGY BAR ============ */
.energy-bar {
    height: 8px;
    background: #1e293b;
    border-radius: 4px;
    overflow: hidden;
}
.energy-fill {
    height: 100%;
    background: linear-gradient(90deg, #facc15, #f97316, #ef4444);
    border-radius: 4px;
    transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.4);
}

/* ============ EQUATION ============ */
.equation {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(255,255,255,0.03);
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 16px 24px;
}
.equation sup { font-size: 0.7em; vertical-align: super; }
.equation sub { font-size: 0.7em; vertical-align: sub; }

/* ============ TABS ============ */
.tab {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.85rem;
    position: relative;
    white-space: nowrap;
}
.tab:hover { color: #22c55e; }
.tab.active { color: #22c55e; border-bottom-color: #22c55e; }
.tab.next { color: #facc15; border-bottom-color: #facc1566; }

/* ============ DRAG GHOST ============ */
.drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    filter: drop-shadow(0 0 20px rgba(34,197,94,0.4));
    transition: none;
}

/* ============ TOAST ============ */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 14px 28px;
    z-index: 200;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ============ CHAIN REACTION CANVAS ============ */
#chain-canvas {
    border-radius: 12px;
    cursor: crosshair;
}

/* ============ BINDING ENERGY CHART ============ */
.chart-container {
    position: relative;
    background: #0d1117;
    border: 1px solid #1e293b;
    border-radius: 12px;
    overflow: hidden;
}

/* ============ STEP INDICATOR ============ */
.step-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.step-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #334155;
    transition: all 0.3s;
}
.step-dot.active {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34,197,94,0.5);
    width: 24px;
    border-radius: 4px;
}
.step-dot.done {
    background: #22c55e;
}

/* ============ COMPARISON TABLE ============ */
.compare-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8rem;
}
.compare-table th {
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 1px solid #1e293b;
}
.compare-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #1e293b10;
    color: #94a3b8;
}
.compare-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

/* ============ SLIDER CUSTOM ============ */
input[type="range"] {
    -webkit-appearance: none;
    height: 6px;
    background: #1e293b;
    border-radius: 3px;
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #22c55e;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(34,197,94,0.4);
    transition: transform 0.2s;
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}
input[type="range"].accent-red::-webkit-slider-thumb { background: #ef4444; box-shadow: 0 0 10px rgba(239,68,68,0.4); }
input[type="range"].accent-orange::-webkit-slider-thumb { background: #f97316; box-shadow: 0 0 10px rgba(249,115,22,0.4); }

/* ============ BACKGROUND STARS ============ */
.stars {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: -1;
}
