body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #1a1a1a;
    color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#simulation-container {
    position: relative;
    width: 95vw;
    height: 95vh;
    border: 2px solid #444;
    /* The background is now drawn on the canvas */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#stats {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 1.5vmin 2vmin; /* Adjusted for mobile */
    border-radius: 8px;
    border: 1px solid #555;
    font-size: 1.8vmin; /* Adjusted for mobile */
    line-height: 1.6;
    pointer-events: none;
}

#stats div {
    display: flex;
    justify-content: space-between;
    min-width: 25vmin; /* Adjusted for mobile */
}

#stats hr {
    border: 0;
    border-top: 1px solid #444;
    margin: 5px 0;
}

#stats strong {
    margin-right: 10px;
    color: #00aaff;
}

#controls {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    gap: 1vmin; /* Adjusted for mobile */
    align-items: center;
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
}

#controls button {
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid #555;
    color: #f0f0f0;
    padding: 1.2vmin 1.8vmin; /* Adjusted for mobile and touch targets */
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.8vmin; /* Adjusted for mobile */
    transition: background-color 0.2s, border-color 0.2s;
    min-width: 6vmin; /* Adjusted for mobile touch targets */
}

#controls button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

#controls button.active {
    background-color: #00aaff;
    border-color: #00aaff;
    color: #1a1a1a;
    font-weight: bold;
}

#controls .control-divider {
    color: #555;
    margin: 0 5px;
}

#world-gen-controls {
    display: flex;
    gap: 5px;
    margin-left: 10px;
}

#world-gen-controls input {
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid #555;
    color: #f0f0f0;
    padding: 1.2vmin 1.8vmin; /* Adjusted for mobile and touch targets */
    border-radius: 5px;
    font-size: 1.8vmin; /* Adjusted for mobile */
}

#world-gen-controls input::placeholder {
    color: #888;
}

#world-gen-controls button {
    font-weight: bold;
}

#inspector {
    position: absolute;
    top: 10px;
    right: 10px;
    width: min(280px, 40vmin); /* Adjusted for mobile: max 280px, but scales down */
    background-color: rgba(0, 0, 0, 0.75);
    padding: 2vmin; /* Adjusted for mobile */
    border-radius: 8px;
    border: 1px solid #555;
    font-size: 1.8vmin; /* Adjusted for mobile */
    line-height: 1.6;
    display: none; /* Initially hidden */
    flex-direction: column;
    color: #f0f0f0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    max-height: calc(95vh - 20px);
    overflow-y: auto;
}

#inspector h3 {
    margin: 0 0 10px 0;
    text-align: center;
    color: #00aaff;
    font-size: 2.2vmin; /* Adjusted for mobile */
    border-bottom: 1px solid #444;
    padding-bottom: 8px;
}

#inspector-content div {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}

#inspector-content strong {
    color: #ccc;
    margin-right: 10px;
}

#inspector-content .value {
    color: #fff;
    font-weight: bold;
}

#inspector-close {
    position: absolute;
    top: 5px;
    right: 5px;
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 3.5vmin; /* Adjusted for mobile */
    line-height: 1;
    cursor: pointer;
    padding: 0 5px;
}

#inspector-close:hover {
    color: #fff;
}