:root {
    --bg: #020617;
    --panel: #ffffff;
    --border: rgba(0, 0, 0, 0.1);
    --primary: #2563eb;
    --secondary: #7c3aed;
    --text: #1e293b;
    --muted: #64748b;
    --panel-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

body.sim-page {
    font-family: 'Outfit', sans-serif;
    color: var(--text);
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #020617;
    touch-action: none;
    overscroll-behavior: none;
}

#phet-stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 1280px;
    height: 720px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
    transform-origin: top left;
    touch-action: none;
}

.sim-nav {
    position: relative !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1.5rem;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    z-index: 200;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.sim-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #1e293b;
    font-size: 1.15rem;
    font-weight: 700;
}

.logo-icon {
    font-size: 1.4rem;
    color: var(--primary);
}

.logo-thin {
    font-weight: 300;
}

.nav-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.nav-breadcrumbs a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-breadcrumbs a:hover {
    color: var(--primary);
}

.nav-breadcrumbs .sep {
    font-weight: 300;
    color: #cbd5e1;
}

.nav-breadcrumbs .current {
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f1f5f9;
    color: #1e293b;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.nav-back:hover {
    background: #ffffff;
    border-color: var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

#sim-app {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Toolbox Styles */
.toolbox {
    width: 100px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 0.6rem;
    gap: 0.75rem;
    z-index: 10;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.02);
    overflow-y: auto;
    touch-action: pan-y;
    box-sizing: border-box;
}

.toolbox-items {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.toolbox-item {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: grab;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.toolbox-item:hover {
    background: #ffffff;
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.toolbox-item i {
    font-size: 1.15rem;
}

.toolbox-item span {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.item-preview {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wire-icon {
    width: 20px;
    height: 3px;
    background: #475569;
    border-radius: 2px;
}

/* Sim Container */
.sim-container {
    flex: 1;
    display: flex;
    position: relative;
}

.canvas-panel {
    flex: 1;
    position: relative;
    background: #ffffff;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 40px 40px;
    overflow: hidden;
    touch-action: none;
}

canvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

/* Control Panel */
.control-panel {
    width: 310px;
    background: var(--panel);
    border-left: 1px solid var(--border);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    z-index: 10;
    overflow-y: auto;
    touch-action: pan-y;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.02);
}

.phet-box {
    background: #f8fafc;
    border-radius: 12px;
    padding: 0.85rem;
    border: 1px solid var(--border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.section-header {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
}

/* Components on Canvas Icons */
.hint-overlay {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    backdrop-filter: blur(4px);
    pointer-events: none;
    animation: fadeInOut 4s forwards;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, 10px);
    }

    10% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* Slider Customization */
.slider-blue {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #dbeafe;
    border-radius: 5px;
    outline: none;
    margin: 15px 0;
}

.slider-blue::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    cursor: pointer;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.val-display {
    font-family: 'Space Grotesk', monospace;
    font-weight: 700;
    color: var(--primary);
}

/* Buttons */
.btn-action {
    background: #f1f5f9;
    border: none;
    padding: 10px 15px;
    border-radius: 10px;
    color: var(--text-main);
    font-family: 'Outfit';
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-action:hover {
    background: #e2e8f0;
}

.btn-action.danger {
    color: var(--danger);
}

.btn-action.danger:hover {
    background: #fee2e2;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.stat-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-item .value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.probe-overlay {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--primary);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    font-size: 0.8rem;
    z-index: 1000;
}

.probe-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-weight: 600;
}

/* Multimeter UI */
.multimeter-body {
    position: absolute;
    width: 140px;
    height: 180px;
    background: #facc15;
    /* Yellow multimeter body */
    border: 3px solid #1e293b;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    padding: 10px;
    z-index: 100;
    cursor: grab;
}

.multimeter-display {
    height: 50px;
    background: #064e3b;
    border-radius: 5px;
    border: 2px solid #1e293b;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Grotesk', monospace;
    color: #34d399;
    font-size: 1.4rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(52, 211, 153, 0.5);
}

.multimeter-dial {
    width: 60px;
    height: 60px;
    background: #1e293b;
    border-radius: 50%;
    margin: 10px auto;
    position: relative;
}

.multimeter-dial::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 25px;
    background: white;
    top: 5px;
    left: 28px;
    border-radius: 2px;
}

.multimeter-port {
    display: flex;
    justify-content: space-around;
    margin-top: auto;
}

.port {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #0f172a;
    border: 2px solid #334155;
}

.multimeter-probe {
    position: absolute;
    width: 12px;
    height: 40px;
    border-radius: 6px;
    z-index: 101;
    cursor: crosshair;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.multimeter-probe.red {
    background: #ef4444;
    border: 2px solid #991b1b;
}

.multimeter-probe.black {
    background: #1e293b;
    border: 2px solid #0f172a;
}

.probe-tip {
    position: absolute;
    bottom: -10px;
    left: 4px;
    width: 4px;
    height: 15px;
    background: #94a3b8;
    border-radius: 2px;
}