:root {
    --primary: #10b981;
    --secondary: #0ea5e9;
    --accent: #f43f5e;
    --bg-light: #f8fafc;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --glass: rgba(255, 255, 255, 0.88);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body.phet-theme {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #000;
    overflow: hidden;
    touch-action: none;
    overscroll-behavior: none;
}

#phet-stage {
    position: absolute;
    top: 0; left: 0;
    transform-origin: top left;
    width: 100%; height: 100%;
    background-color: var(--bg-light);
    display: flex;
    flex-direction: column;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 30px;
    background: white;
    border-bottom: 1px solid var(--border);
    z-index: 1000;
}

.logo { font-weight: 700; font-size: 1.2rem; display: flex; align-items: center; gap: 5px; }
.logo span { color: var(--primary); font-weight: 300; }
.divider { margin: 0 12px; color: var(--border); }
.chapter-name { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }

#sim-app {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    position: relative;
}

.sim-container {
    flex: 1;
    display: flex;
    position: relative;
}

.canvas-panel {
    flex: 1;
    position: relative;
    background: #ffffff;
    overflow: hidden;
    height: 100%;
    width: 100%;
}

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

.physics-dashboard {
    position: absolute;
    top: 40px;
    right: 30px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    width: 240px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 18px;
    z-index: 100;
}

.dash-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}

.drag-handle {
    cursor: grab;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.dash-item label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-val {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.85rem;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: -5px;
}

.dash-stats {
    margin-top: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-line {
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
}

.stat-line span {
    color: #1e293b;
    font-weight: 700;
}

.pulley-control {
    margin-top: 5px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.action-btn.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    background: #0ea171;
}

.action-btn-outline {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: transparent;
    color: #64748b;
    font-weight: 700;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn-outline:hover {
    background: #f1f5f9;
    color: var(--accent);
}

.status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #475569;
}

.nav-reset-btn {
    background: #e2e8f0;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.75rem;
    color: #475569;
    cursor: pointer;
}
.nav-reset-btn:hover { background: #cbd5e1; }

/* Friction Graph Case */
.friction-graph-container {
    position: absolute;
    top: 40px;
    left: 40px;
    width: 320px;
    height: 220px;
    background: #1e293b;
    border-radius: 12px;
    border: 4px solid #334155;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
}

.friction-graph-container header {
    background: #334155;
    color: #f1f5f9;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 6px 10px;
    text-align: center;
    letter-spacing: 0.5px;
}

#graphCanvas {
    flex: 1;
    width: 100%;
}

/* Surface Selection Buttons */
.surface-selector {
    position: absolute;
    bottom: 30px;
    right: 30px;
    display: flex;
    gap: 10px;
    z-index: 200; /* Ensure it's on top of canvas and dashboard */
}

.surface-btn {
    background: white;
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    color: #475569;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.surface-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.surface-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

/* Visual Legend */
.visual-legend {
    position: absolute;
    bottom: 30px;
    left: 25px;
    background: rgba(255, 255, 255, 0.9);
    padding: 14px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item { display: flex; align-items: center; gap: 12px; font-size: 0.8rem; font-weight: 600; }
.legend-item span.arrow { width: 25px; height: 3px; border-radius: 2px; }
.legend-item span.arrow.green { background: #10b981; }
.legend-item span.arrow.red { background: #f43f5e; }
.legend-item span.arrow.blue { background: #0ea5e9; }

/* Custom Sliders */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    outline: none;
    margin: 10px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }


