:root {
    --primary-color: #007bff; /* Blue for highlights */
    --secondary-color: #6c757d; /* Gray for subtle details */
    --background-color: #f8f8f8; /* Off-white for professional background */
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    color: #333;
    line-height: 1.6;
    display: flex;
    justify-content: center;
}

#simulation-container {
    width: 95%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: var(--shadow);
    border-radius: 10px;
    text-align: center;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-weight: 600;
}

/* Canvas Styling */
#p5-canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    /* Realistic texture effect */
    background: repeating-linear-gradient(45deg, #f0f0f0, #f0f0f0 10px, #ffffff 10px, #ffffff 20px);
}

/* Controls and Data Panel Layout */
#controls, #data-panel {
    background-color: #fefefe;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin: 15px 0;
    text-align: left;
}

#controls h2, #data-panel h2 {
    margin-top: 0;
    color: var(--primary-color);
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.control-group {
    margin-bottom: 10px;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
}

select, input[type="range"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: 600;
}

button:hover {
    background-color: #0056b3;
}

/* Device Status Styling */
#device-status {
    border-top: 2px solid var(--secondary-color);
    padding-top: 10px;
    margin-top: 10px;
}

#sensor-status {
    font-size: 1.1em;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 4px;
    display: inline-block;
}

.status-off {
    background-color: #ffdddd;
    color: #cc0000;
}

.status-on {
    background-color: #ddffdd;
    color: #008000;
}

/* --- Mobile Responsiveness (Portrait/Landscape) --- */

/* Default: Portrait view for smaller screens */
@media (max-width: 768px) {
    #simulation-container {
        padding: 10px;
        margin: 10px auto;
    }
}

/* Landscape view for tablets/larger phones */
@media (min-width: 769px) and (max-width: 1024px) {
    #controls, #data-panel {
        display: inline-block;
        width: 48%;
        margin: 1%;
        vertical-align: top;
    }
}

/* Larger screens (Desktop/Wide Landscape) */
@media (min-width: 1025px) {
    /* Layout can be adapted further here, e.g., using grid or flexbox for a multi-column layout */
}
