:root {
    --phet-blue: #0ea5e9;
    --phet-yellow: #fbbf24;
    --phet-green: #10b981;
    --phet-panel: #e2e8f0;
    --phet-bg: #bde4f4;
    --text-dark: #1e293b;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: #000;
    color: var(--text-dark);
    height: 100vh;
    overflow: hidden;
    touch-action: none;
    overscroll-behavior: none;
}

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

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;
}

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

/* --- Navigation links from index.css --- */
.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    align-items: center;
}

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

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

.back-btn {
    color: white;
    text-decoration: none;
    font-size: 1.2rem;
    transition: transform 0.2s;
}

.back-btn:hover {
    transform: translateX(-3px);
}

h1 {
    font-size: 1.2rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Viewport */
.sim-viewport {
    flex: 1;
    display: flex;
    background: var(--phet-bg);
    position: relative;
    padding: 10px;
    gap: 10px;
    min-height: 0; /* Important for flex flow */
}

.canvas-section {
    flex: 1;
    position: relative;
    background: #f8fafc;
    border: 2px solid #94a3b8;
    border-radius: 8px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.sim-stage {
    width: 100%;
    height: 100%;
}

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

/* Control Panel */
.control-panel {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.section-header {
    text-align: center;
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 1rem;
    color: #334155;
    border-bottom: 1px solid #cbd5e1;
    padding-bottom: 5px;
}

/* Voltmeter Component */
.voltmeter {
    height: 80px;
    background: #fff;
    border: 2px solid #333;
    border-radius: 40px 40px 10px 10px;
    position: relative;
    margin-top: 20px;
    overflow: hidden;
}

.meter-scale {
    position: absolute;
    bottom: 5px;
    left: 50%;
    width: 120px;
    height: 60px;
    border: 1px solid #999;
    border-bottom: none;
    border-radius: 60px 60px 0 0;
    transform: translateX(-50%);
}

.meter-scale::before {
    content: '- +';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    font-size: 0.8rem;
    font-weight: bold;
}

.needle {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 2px;
    height: 50px;
    background: #ef4444;
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(0deg);
    transition: transform 0.05s linear;
}

/* Settings Row */
.setting-row {
    margin: 8px 0;
}

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

/* Action Buttons */
.yellow-btn {
    width: 100%;
    padding: 10px;
    background: var(--phet-yellow);
    border: 2px solid #d97706;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.2s;
}

.yellow-btn:hover {
    filter: brightness(1.05);
}

/* Modal Styling */
.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: 30px;
    border-radius: 20px;
    width: 400px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.btn-close {
    margin-top: 20px;
    width: 100%;
    padding: 10px;
    background: var(--phet-blue);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}