:root {
    --bg-color: #f4f4f5;
    --panel-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --accent: #10b981; /* Muted Green */
    --accent-hover: #059669;
    --road-color: #374151;
    --sidewalk-color: #d1d5db;
    --building-color: #e5e7eb;
    --sky-color: #e0f2fe;
    --border-radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background: var(--panel-bg);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* APP LAYOUT */
.app-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: calc(100vh - 70px); /* Fill remaining height */
}

/* CONTROLS (Input Panel) */
aside#controls {
    background: var(--panel-bg);
    padding: 1.5rem;
    overflow-y: auto;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-group h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 0.25rem;
}

label {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.input-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

input[type="range"] {
    flex: 1;
    accent-color: var(--text-main);
}

select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.value-display {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 3rem;
    text-align: right;
}

.checkbox-group {
    display: flex;
    gap: 1rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    cursor: pointer;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.hidden {
    display: none;
}

/* MAIN AREA */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
    position: relative;
    overflow: hidden;
}

/* ANALYSIS BAR */
#analysis-bar {
    background: var(--panel-bg);
    padding: 1rem;
    display: flex;
    gap: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    align-items: center;
    justify-content: space-around;
}

.stat-box {
    display: flex;
    flex-direction: column;
}

.stat-box .label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-box .value {
    font-weight: 600;
    color: var(--text-main);
}

.stat-box .desc {
    font-size: 0.875rem;
    color: var(--accent);
}

/* VISUALIZATION */
#visualization-container {
    flex: 1;
    position: relative;
    background: linear-gradient(to bottom, #eff6ff 0%, #ffffff 80%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 2rem; /* Ground level offset */
    overflow: hidden;
}

#scene-wrapper {
    display: flex;
    align-items: flex-end;
    position: relative;
    bottom: 0;
    transition: all 0.3s ease;
}

/* SCENE ELEMENTS */
.building {
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    position: relative;
    transition: height 0.3s ease, background-color 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
}

.building::after {
    /* Windows pattern */
    content: '';
    position: absolute;
    top: 5px; left: 5px; right: 5px; bottom: 0;
    background-image: 
        linear-gradient(#d1d5db 1px, transparent 1px),
        linear-gradient(90deg, #d1d5db 1px, transparent 1px);
    background-size: 20px 30px; /* Floor height approx */
    opacity: 0.3;
}

.building.active-frontage {
    border-bottom: 4px solid var(--accent);
}
.building.active-frontage::before {
    content: 'SHOP';
    position: absolute;
    bottom: 0; width: 100%; text-align: center;
    font-size: 10px; padding: 5px 0;
    background: rgba(255,255,255,0.8);
}

.building.blank-edge {
    background-color: #9ca3af;
}

#street-section {
    display: flex;
    align-items: flex-end;
}

.footpath {
    background-color: #e5e7eb;
    border-top: 1px solid #9ca3af;
    position: relative;
    transition: width 0.3s ease;
}

.road-lane {
    background-color: var(--road-color);
    position: relative;
    border-right: 1px dashed rgba(255,255,255,0.3);
    transition: width 0.3s ease;
}
.road-lane:last-child {
    border-right: none;
}

.median {
    background-color: #15803d; /* Green median default */
    position: relative;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #ffffff;
    transition: width 0.3s ease;
}

/* ASSETS: Trees, People, Lights */
.tree {
    position: absolute;
    bottom: 0;
    width: 20px; /* Base width */
    height: 40px;
    background: #166534;
    border-radius: 50% 50% 0 0;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}
.tree::after {
    content: '';
    position: absolute;
    bottom: -10px; /* Trunk */
    left: 40%;
    width: 20%;
    height: 10px;
    background: #78350f;
}

.person {
    position: absolute;
    bottom: 0;
    width: 4px; /* Head/Body wrapper width */
    height: 12px; /* Approx scale height */
    background: #ef4444; 
    border-radius: 2px;
}
.person::before {
    /* Head */
    content: '';
    position: absolute;
    top: -4px; left: -1px;
    width: 6px; height: 6px;
    background: #ef4444;
    border-radius: 50%;
}

.light-post {
    position: absolute;
    bottom: 0;
    width: 2px;
    height: 30px;
    background: #4b5563;
    left: 5px;
}
.light-post::after {
    content: '';
    position: absolute;
    top: 0; right: -5px;
    width: 6px; height: 3px;
    background: #fbbf24;
    border-radius: 0 0 5px 5px;
}

/* EDUCATIONAL PANEL */
#education {
    background: #fff;
    border-top: 1px solid #e5e7eb;
    padding: 1rem;
}
details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-main);
    outline: none;
}
details .content {
    margin-top: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-muted);
    max-width: 800px;
}

/* RESPONSIVE */
@media (min-width: 768px) {
    .app-container {
        flex-direction: row;
    }
    aside#controls {
        width: 320px;
        height: 100%;
        border-right: 1px solid #e5e7eb;
        border-bottom: none;
    }
    main {
        height: 100%;
    }
    #visualization-container {
        padding-bottom: 4rem;
    }
}

@media (min-width: 1024px) {
    aside#controls {
        width: 350px;
    }
    #analysis-bar {
        justify-content: center;
        gap: 3rem;
    }
}
