:root {
    --bg-deep: #020617;
    --panel-glass: rgba(15, 23, 42, 0.7);
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.3);
    --secondary: #10b981;
    --accent: #f59e0b;
    --danger: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.15);
}

body.inspector-theme {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background-color: #000;
    color: var(--text-main);
    overflow: hidden;
    touch-action: none;
}

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

nav {
    position: relative !important;
    background: #ffffff !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: #0f172a !important;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    flex-shrink: 0;
    top: 0 !important;
    z-index: 1000;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: #64748b;
    font-weight: 600;
}

.inspector-app {
    flex: 1;
    display: grid;
    grid-template-columns: 380px 1fr;
    overflow: hidden;
    min-height: 0;
}

/* Sidebar Styling */
.control-center {
    background: rgba(15, 23, 42, 0.5);
    border-right: 1px solid var(--border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: 100%;
    overflow-y: auto;
    z-index: 10;
}

.mode-selector {
    display: grid;
    gap: 12px;
}

.mode-btn {
    background: var(--panel-glass);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
    color: inherit;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
    border-color: var(--primary);
}

.mode-btn.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

.btn-icon {
    font-size: 1.5rem;
}

.btn-text .label {
    display: block;
    font-size: 1rem;
    font-weight: 700;
}

.btn-text .desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Stats Card */
.stats-card {
    background: var(--panel-glass);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    flex-shrink: 0;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--secondary);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--secondary);
    animation: blink 2s infinite;
}

@keyframes blink {
    50% { opacity: 0.3; }
}

.empty-state {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 15px 0;
}

.empty-state span {
    color: var(--accent);
    font-weight: 700;
}

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

.formula {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.equation {
    font-size: 1.4rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
}

.verdict {
    background: rgba(16, 185, 129, 0.15);
    color: var(--secondary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
}

/* toolbox modifier */
.toolbox-compact {
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 16px;
}

.toolbox-compact h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.modifier-row {
    margin-bottom: 16px;
}

.modifier-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

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

.modifier-info span {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(245, 158, 11, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

input[type="range"] {
    width: 100%;
}

.btn-reset-circuit {
    width: 100%;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-reset-circuit:hover {
    color: #fff;
    border-color: #fff;
}

/* Viewport Styling */
.viewport {
    position: relative;
    overflow: hidden;
    background-image: radial-gradient(circle at 50% 50%, #0f172a 0%, #020617 100%);
    height: 100%;
}

canvas#simCanvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.toast {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    padding: 8px 20px;
    border-radius: 100px;
    font-size: 0.75rem;
    border: 1px solid var(--border);
    pointer-events: none;
    color: #fff;
}

/* Theory Bar */
.theory-bar {
    position: absolute;
    bottom: 0;
    left: 380px;
    right: 0;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(30px);
    border-top: 1px solid var(--border);
    height: 80px;
    display: flex;
    padding: 0 40px;
    gap: 40px;
    align-items: center;
    z-index: 5;
}

.theory-item {
    display: flex;
    gap: 12px;
    align-items: center;
    opacity: 0.4;
    transition: opacity 0.3s;
}

.theory-item.active {
    opacity: 1;
}

.theory-item .key {
    background: var(--accent);
    color: #000;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 0.65rem;
}

.theory-item p {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 400px;
    margin: 0;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 24px;
    width: 480px;
    max-width: 90%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    color: #0f172a;
}

.modal-content h2 {
    margin-top: 0;
    font-weight: 800;
}

.modal-content ul {
    margin: 20px 0;
    padding-left: 20px;
    color: #475569;
    line-height: 1.6;
}

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