/* ================================================================
   PHOTOSYNTHESIS SIMULATOR — PhET-Style Scale-to-Fit Layout
   Desktop view is the "true" design. On mobile the entire
   #phet-stage is scaled down via JS transform: scale() to fit
   the screen — identical to how PhET simulations work.
   ================================================================ */

/* --- Root viewport: always fills the real screen exactly --- */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #eef2f6; /* Matching Hooke's background */
    color: #0f172a;
    font-family: 'Outfit', sans-serif;
    overscroll-behavior: none;
    touch-action: none; /* Disable browser defaults for panning */
}

/* ----------------------------------------------------------------
   #phet-stage  — The fixed-size "design canvas"
   JS sets its width/height and transform: scale() dynamically.
   Think of it like a 1280×720 TV inside whatever-size room.
   ---------------------------------------------------------------- */
#phet-stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 1280px;
    height: 720px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: 0 0; /* Updated for custom pan/zoom math */
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
    touch-action: none;
}

/* ----------------------------------------------------------------
   Everything inside #phet-stage uses the SAME px values as desktop.
   Nothing below changes on mobile — JS handles the zoom.
   ---------------------------------------------------------------- */


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

.nav-links a {
    color: #475569 !important;
}

.nav-links a:hover {
    color: #10b981 !important;
}

.lab-container {
    flex: 1;
    display: flex;
    width: 100%;
    overflow: hidden;
}

.canvas-area {
    flex: 1;
    position: relative;
    background: radial-gradient(circle at center, #ffffff 0%, #f1f5f9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-direction: column;
}

#simCanvas {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    width: 100%;
    height: 100%;
    max-width: 900px;
    max-height: 600px;
}

.chart-container {
    position: absolute;
    bottom: 20px;
    right: 30px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    z-index: 5;
}

/* Stats Overlay */
.stats-overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    max-width: 900px;
    margin: 0 auto;
    z-index: 5;
}

.stat-panel {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    pointer-events: auto;
    min-width: 140px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.stat-panel.legend {
    width: 180px;
}

.stat-line {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.75rem;
    font-family: 'Space Grotesk', sans-serif;
    text-transform: uppercase;
    align-items: center;
}

.stat-label {
    color: #64748b;
}

.stat-value {
    font-weight: 700;
    color: #0f172a;
}

/* Controls Panel */
.controls-panel {
    width: 380px;
    background: #ffffff;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    overflow-y: auto;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.03);
}

.control-group {
    background: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 1.2rem;
}

.control-group h3 {
    font-size: 0.95rem;
    margin-bottom: 1rem;
    color: #ec4899;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.slider-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.8rem;
}

.slider-label {
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 0.4rem;
    display: flex;
    justify-content: space-between;
}

input[type="range"] {
    width: 100%;
    accent-color: #ec4899;
    height: 6px;
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background: #e2e8f0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ec4899;
    cursor: pointer;
}

.btn-lab {
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-lab:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.btn-lab:active {
    transform: translateY(1px);
}