/* style.css */
* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: sans-serif;
    background-color: #f0f0f0;
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

#main-panel {
    background: #51494e;
    flex: 1 1 auto;
    min-width: 0;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

#gameCanvas {
    width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#sidebar {
    flex: 0 0 360px;
    height: 100vh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border-right: 1px solid #ccc;
    font-family: system-ui, sans-serif;
    padding: 12px;
    gap: 10px;
    overflow: hidden; /* children manage scroll */
}

#sidebar input,
#sidebar select,
#sidebar option,
#sidebar button,
#sidebar textarea {
    font-family: inherit;
}

#sidebar > section,
#sidebar > header,
#sidebar > #action-buttons {
    flex: 0 0 auto;
}

#sidebar .scrollable {
    min-height: 80px;
    overflow-y: auto;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 8px;
}

#sidebar > #players {
    flex: 2 1 0;
}
#sidebar > #network-sim {
    flex: 4 1 0;
}

/* --- Header --- */
#sidebar-header h1 {
    margin: 0 0 6px 0;
}

#status { font-weight: bold; margin-bottom: 4px; }
#timer { font-size: 1.1em; margin-bottom: 8px; }

#name-input-section label,
#map-selector-section label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.9em;
}

.row {
    display: flex;
    gap: 6px;
}

.row input[type="text"],
.row select {
    flex: 1 1 auto;
    min-width: 0;
    padding: 5px;
}

.row button {
    flex: 0 0 auto;
    padding: 5px 10px;
    width: auto;
    margin: 0;
}

/* --- Players list --- */
#players h2 {
    margin: 0 0 6px 0;
    font-size: 1em;
}

#player-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#player-list li {
    margin-bottom: 5px;
    display: flex;
    align-items: center;
}

.player-color-box {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 5px;
    border: 1px solid #555;
}

.player-dead {
    text-decoration: line-through;
    opacity: 0.6;
}

/* --- Buttons --- */
button {
    padding: 8px 12px;
    font-size: 0.95em;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

#action-buttons button {
    display: block;
    margin-top: 6px;
}

#winner-display {
    margin-top: 10px;
    font-weight: bold;
    font-size: 1.2em;
    color: green;
    text-align: center;
}
#winner-display.draw { color: orange; }

/* --- Stats --- */
#stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8em;
    background: #222;
    color: white;
    padding: 6px 8px;
    border-radius: 3px;
    flex-wrap: wrap;
}

#stats #rtc-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #555;
    margin-left: auto;
}

#stats #rtc-indicator.connected { background-color: orange; }
#stats #rtc-indicator.active { background-color: limegreen; }

/* --- Network sim --- */
#network-sim {
    font-size: 0.8em;
}

#network-sim .section-title {
    font-weight: bold;
    border-bottom: 1px solid #ccc;
    padding-bottom: 4px;
    margin-bottom: 8px;
}

#network-sim .subsection-title {
    font-weight: bold;
    border-top: 1px solid #ddd;
    padding-top: 6px;
    margin-top: 8px;
    margin-bottom: 6px;
}

#network-sim .field { margin-bottom: 6px; }

#network-sim input[type="range"] { width: 100%; }

#network-sim .checkbox {
    cursor: pointer;
    display: block;
    margin-bottom: 4px;
}

#network-sim .hint {
    margin-top: 8px;
    font-size: 1em;
    color: #888;
}
