/* ── PhET Scaling Base ───────────────────────────────────── */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* PhET Stage — scalable container */
#phet-stage {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top left;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #f8fafc;
    color: #0f172a;
    font-family: 'Outfit', sans-serif;
}

nav {
    background: rgba(255, 255, 255, 0.95) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: #0f172a !important;
    position: relative;
    width: 100%;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.logo a {
    font-size: 1.4rem;
    font-weight: bold;
}

.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 15px;
    margin-right: 20px;
}

.nav-links a {
    text-decoration: none;
    color: #475569;
    font-weight: 600;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: #10b981;
}

#sim-app {
    display: flex;
    height: 100%;
    width: 100%;
    flex: 1;
    min-height: 0;
}

.sim-container {
    flex: 1;
    display: flex;
}

.canvas-panel {
    background: radial-gradient(circle at center, #ffffff 0%, #f1f5f9 100%);
    overflow: hidden;
}

#simCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.control-panel {
    width: 210px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: 1px solid rgba(255, 255, 255, 0.4);
    padding: 0.8rem;
    overflow-y: auto;
    box-shadow: -8px 0 25px rgba(0, 0, 0, 0.04);
    z-index: 10;
}

.control-panel::-webkit-scrollbar {
    width: 6px;
}

.control-panel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.phet-box {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    padding: 0.7rem;
    margin-bottom: 0.7rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.phet-box:hover {
    box-shadow: 0 6px 15px -3px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.section-header {
    font-size: 0.75rem;
    margin-bottom: 0.4rem;
    color: #10b981;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 0.3rem;
}

label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #475569;
    cursor: pointer;
    margin-bottom: 5px;
    user-select: none;
    transition: color 0.15s ease;
}

label:hover {
    color: #0f172a;
}

/* Custom Checkboxes and Radios matching PhET/Modern UI */
input[type="radio"],
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border: 1.5px solid #cbd5e1;
    background: #f8fafc;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

input[type="radio"] {
    border-radius: 50%;
}

input[type="checkbox"] {
    border-radius: 3px;
}

input[type="radio"]:hover:not(:disabled),
input[type="checkbox"]:hover:not(:disabled) {
    border-color: #10b981;
    background: #ecfdf5;
}

input[type="radio"]:checked,
input[type="checkbox"]:checked {
    background: #10b981;
    border-color: #10b981;
}

input[type="radio"]:checked::before {
    content: "";
    width: 5px;
    height: 5px;
    background: white;
    border-radius: 50%;
}

input[type="checkbox"]:checked::before {
    content: "✓";
    color: white;
    font-size: 10px;
    font-weight: bold;
    display: block;
    line-height: 1;
}

input[type="checkbox"]:disabled,
input[type="radio"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #e2e8f0;
    border-color: #cbd5e1;
}

input[type="range"] {
    width: 100%;
    accent-color: #10b981;
    height: 6px;
    border-radius: 6px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background: #f1f5f9;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #10b981;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(16, 185, 129, 0.4);
    border: 2px solid white;
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider-with-btns {
    width: 100%;
    margin-top: 5px;
}

.control-group {
    margin-bottom: 10px;
}

.val-display {
    font-size: 0.8rem;
    text-align: right;
    color: #0f172a;
    font-weight: 600;
}

.draggable {
    position: absolute;
    cursor: grab;
}

/* Ruler */
#ruler {
    top: 50px;
    left: 50px;
    background: rgba(255, 235, 120, 0.9);
    border: 1px solid #baa624;
    border-radius: 4px;
    height: 30px;
    cursor: grab;
    z-index: 20;
    box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.1);
}

#ruler:active {
    cursor: grabbing;
}