:root {
    --phet-blue: #0ea5e9;
    --phet-yellow: #fbbf24;
    --phet-green: #10b981;
    --phet-panel: #f1f5f9;
    --phet-bg: #f8fafc;
    --proton-red: #ef4444;
    --neutron-grey: #94a3b8;
    --text-dark: #1e293b;
}

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

html,
body.phet-theme {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #f8fafc;
    font-family: 'Outfit', sans-serif;
    overscroll-behavior: none;
    touch-action: none;
}

#phet-stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 1280px;
    height: 720px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: 0 0;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.2);
    touch-action: none;
}

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-dark);
}

.simulation-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Nav Bar */
.sim-nav {
    position: relative;
    background: #f8fafc;
    height: 65px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    border-bottom: 2px solid #e2e8f0;
    flex-shrink: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: #1e293b;
}

.separator {
    color: #cbd5e1;
    font-weight: 300;
}

.subject-tag {
    font-size: 0.95rem;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.experiment-tag {
    font-size: 0.95rem;
    color: #3b82f6;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.back-btn {
    text-decoration: none;
    color: #64748b;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.back-btn:hover {
    color: #3b82f6;
}

/* Viewport */
.sim-viewport {
    flex: 1;
    display: flex;
    background: var(--phet-bg);
}

.nucleus-section {
    flex: 1;
    position: relative;
    background: radial-gradient(circle, #f8fafc 0%, #e2e8f0 100%);
    overflow: hidden;
}

canvas {
    width: 100%;
    height: 100%;
}

/* Half-life Scale Styling */
.half-life-scale-container {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 5;
}

.half-life-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.info-bubble {
    width: 35px;
    height: 35px;
    background: #ec4899;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.4);
    border: 2px solid white;
}

.half-life-label {
    font-size: 2.2rem;
    font-weight: 400;
    color: #1e293b;
}

#scale-value {
    font-weight: 400;
    font-size: 2.5rem;
}

.stability-scale {
    width: 100%;
    position: relative;
    padding-bottom: 40px;
}

.scale-main-line {
    width: 100%;
    height: 2px;
    background: #000;
}

.scale-ticks {
    position: absolute;
    top: -5px;
    left: 0;
    width: 100%;
}

.tick {
    position: absolute;
    width: 2px;
    height: 15px;
    background: #000;
}

.tick.major {
    height: 25px;
    top: -10px;
}

.scale-major-labels {
    position: absolute;
    top: 15px;
    width: 100%;
    display: flex;
    justify-content: space-between;
}

.scale-major-labels span {
    position: absolute;
    transform: translateX(-50%);
    font-size: 1.1rem;
    font-weight: 500;
    color: #000;
}

.stability-pointer {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    color: #ec4899;
    font-size: 1.8rem;
    transition: left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-footer {
    position: absolute;
    top: 55px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 500;
}

.less-stable,
.more-stable {
    color: #000;
}

.seconds-unit {
    color: #000;
}

.infinity-arrow {
    position: absolute;
    top: -55px;
    right: -20px;
    color: #ec4899;
    font-size: 1.5rem;
    display: none;
}

/* Global Action Buttons */
.actions-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    background: #e2e8f0;
    color: #475569;
}

.action-btn:hover {
    filter: brightness(0.95);
    transform: translateY(-2px);
}

.stable-btn {
    background: #3b82f6;
    color: white;
}

.reset-btn {
    background: #ef4444;
    color: white;
}

.help-btn {
    background: #10b981;
    color: white;
}

/* Nuclear Warning Toast */
.warning-toast {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(239, 68, 68, 0.9);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
    z-index: 100;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    display: block;
}

.warning-toast.show {
    opacity: 1;
    top: 90px;
}

/* PhET Style Symbol Box */
.symbol-box {
    background: #eef9ff;
    border: 1px solid #94a3b8;
    border-radius: 8px;
    padding: 10px;
    width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.box-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.toggle-icon {
    color: #f97316;
    /* Orange icon */
    font-size: 1.2rem;
}

.box-title {
    font-size: 1.2rem;
    font-weight: 500;
    color: #000;
}

.symbol-card {
    background: #fff;
    border: 1px solid #334155;
    width: 100px;
    height: 120px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5px;
}

.card-left-nums {
    position: absolute;
    left: 8px;
    top: 5px;
    bottom: 5px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 1.8rem;
    font-weight: 500;
    line-height: 1;
}

.atomic-num {
    color: #f97316;
    /* Orange atomic number per reference */
}

#element-symbol {
    font-size: 4rem;
    font-weight: 400;
}

.element-name-overlay {
    margin-top: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
}

/* Info Overlay */
.info-overlay {
    position: absolute;
    padding: 20px;
    pointer-events: none;
    z-index: 10;
}

.top-left {
    top: 0;
    left: 0;
}

/* Particle Controls */
.particle-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 40px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 40px;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    border: 2px solid #cbd5e1;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.stepper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.step-btn {
    width: 32px;
    height: 32px;
    background: #f1f5f9;
    border: 1.5px solid #94a3b8;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #475569;
    transition: all 0.1s;
    box-shadow: 0 2px 0 #94a3b8;
}

.step-btn:active {
    transform: translateY(2px);
    box-shadow: 0 0 0 transparent;
}

.step-btn.up:hover {
    color: #f97316;
}

.step-btn.down:hover {
    color: #3b82f6;
}

.label-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.label-box span {
    font-size: 1rem;
    font-weight: 700;
    color: #2563eb;
    letter-spacing: 0.5px;
}

.particle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: inset -5px -5px 10px rgba(0, 0, 0, 0.2), 2px 2px 5px rgba(0, 0, 0, 0.1);
}

.particle.small {
    width: 30px;
    height: 30px;
}

.proton {
    background: radial-gradient(circle at 30% 30%, #f87171, #ef4444);
}

.neutron {
    background: radial-gradient(circle at 30% 30%, #cbd5e1, #94a3b8);
}

.inventory-bin span {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
}

/* Control Panel */
.control-panel {
    width: 280px;
    background: #f8fafc;
    border-left: 2px solid #cbd5e1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.phet-box {
    background: var(--phet-panel);
    border: 3px solid #64748b;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.status-light {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--phet-green);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

#stability-text {
    font-weight: 700;
    font-size: 0.95rem;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #dee2e6;
}

.section-header {
    font-weight: 700;
    color: #475569;
    font-size: 0.9rem;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.phet-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.yellow-btn {
    width: 100%;
    padding: 12px;
    background: var(--phet-yellow);
    border: 2px solid #d97706;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    color: #78350f;
    cursor: pointer;
    box-shadow: 0 4px 0 #d97706;
    transition: all 0.1s;
}

.yellow-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #d97706;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 25px;
    width: 90%;
    max-width: 500px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--phet-blue);
}

.manual-section {
    margin-bottom: 20px;
}

.manual-section h3 {
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.btn-close {
    width: 100%;
    padding: 12px;
    background: var(--phet-blue);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}