:root {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #38bdf8;
    --accent-orange: #fb923c;
    --accent-green: #4ade80;
    --accent-red: #f87171;
    --glass-blur: blur(12px);
}

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

body {
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

header {
    width: 100%;
    padding: 2rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.simulation-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1.5fr;
    gap: 2rem;
    width: 95%;
    max-width: 1400px;
    padding: 1rem;
    flex-grow: 1;
}

.panel {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.panel:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.panel-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Weather Panel */
.weather-display {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.temp-main {
    font-size: 4rem;
    font-weight: 800;
    margin: 1rem 0;
}

.weather-stats {
    width: 100%;
    margin-top: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 16px;
    text-align: left;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-blue);
}

/* AC Panel */
.ac-controls {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    justify-content: center;
    height: 100%;
}

.ac-display {
    background: #000;
    border-radius: 50%;
    width: 200px;
    height: 200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 8px solid #1e293b;
    box-shadow: inset 0 0 20px rgba(56, 189, 248, 0.2), 0 0 30px rgba(0,0,0,0.5);
    position: relative;
}

.ac-temp {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent-blue);
}

.ac-mode {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.slider-container {
    width: 100%;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    margin-top: -8px;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: white;
    padding: 0.75rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

button:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

button.active {
    background: var(--accent-blue);
    color: #0f172a;
}

/* People Panel */
.people-stage {
    flex-grow: 1;
    position: relative;
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    padding-bottom: 2rem;
}

.character {
    width: 120px;
    height: 250px;
    position: relative;
    transition: transform 0.3s ease;
}

.character svg {
    width: 100%;
    height: 100%;
}

.environment-indicator {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--accent-blue);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-blue);
    z-index: 10;
}

#btn-play {
    background: var(--accent-orange);
    color: #000;
    font-weight: 800;
    border: none;
    box-shadow: 0 4px 15px rgba(251, 146, 60, 0.3);
}

#btn-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(251, 146, 60, 0.5);
}

#btn-play:disabled {
    background: var(--text-secondary);
    opacity: 0.5;
    cursor: not-allowed;
}

/* Animations */
@keyframes sway {
    0% { transform: rotate(-2deg); }
    100% { transform: rotate(2deg); }
}

.sway-anim {
    animation: sway 3s ease-in-out infinite alternate;
    transform-origin: bottom center;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

.pulse {
    animation: pulse 2s infinite alternate;
}

footer {
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsive Layout */
@media (max-width: 1024px) {
    .simulation-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0.5rem;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .panel {
        padding: 1.5rem;
    }

    .people-stage {
        min-height: 300px;
    }
}

.explanation-section ul {
    list-style: none;
    margin-top: 1rem;
}

.explanation-section li {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
}

.explanation-section li::before {
    content: "•";
    color: var(--accent-blue);
    position: absolute;
    left: 0;
    font-weight: bold;
}

input[type=number] {
    -moz-appearance: textfield;
}

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input:focus {
    outline: none;
    border-bottom-color: var(--accent-blue) !important;
}

#history-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

#history-table td {
    font-size: 0.95rem;
    transition: background 0.2s;
}
