:root {
    --bg-panel: #f8f9fa;
    --bg-body: #ffffff;
    --text-main: #212529;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --input-border: #ced4da;
    --accent-color: #0d6efd;
    --shadow: rgba(0, 0, 0, 0.1);
}

body.dark-mode {
    --bg-panel: #1e1e24;
    --bg-body: #121214;
    --text-main: #f8f9fa;
    --text-muted: #adb5bd;
    --border-color: #2d2d34;
    --input-border: #495057;
    --accent-color: #375a7f;
    --shadow: rgba(0, 0, 0, 0.4);
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.3s, color 0.3s;
}

/* Primary Sidebar Panel Layout Mapping */
#sidebar {
    width: 360px;
    min-width: 360px;
    max-height: 100vh;
    background: var(--bg-panel);
    padding: 20px;
    box-shadow: 2px 0 5px var(--shadow);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    border-right: 1px solid var(--border-color);
    box-sizing: border-box;
}

#map {
    flex-grow: 1;
    height: 100%;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.sidebar-header h1 {
    font-size: 20px;
    margin: 0;
    font-weight: bold;
}

#theme-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

/* Control Panel Buttons Alignment */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.control-panel .btn {
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: opacity 0.1s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn-start { background: #198754; color: white; }
.btn-danger { background: #dc3545; color: white; }
.btn-secondary { background: var(--input-border); color: var(--text-main); }

button:disabled { 
    background: var(--input-border) !important; 
    color: var(--text-muted) !important;
    opacity: 0.5; 
    cursor: not-allowed; 
    box-shadow: none !important;
}

/* Real-time Scoreboard Statistics Grid Grid */
.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.stat-box {
    background: var(--bg-body);
    padding: 10px;
    text-align: center;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 18px;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.pb-box {
    background: linear-gradient(145deg, rgba(13, 110, 253, 0.05), rgba(13, 110, 253, 0.15));
    border: 1px solid rgba(13, 110, 253, 0.3);
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    margin-bottom: 15px;
}

.stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    font-weight: normal;
}

.stat-value {
    display: block;
}

#timer-display {
    font-family: monospace;
    font-size: 20px;
}

.success-text { color: #198754; }
body.dark-mode .success-text { color: #2ec4b6; }

/* Text Processing Input Field */
.input-container {
    margin-bottom: 10px;
}

input[type="text"] {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    background: var(--bg-body);
    color: var(--text-main);
    border: 2px solid var(--input-border);
    border-radius: 6px;
    box-sizing: border-box;
    outline: none;
}

input[type="text"]:focus:not(:disabled) {
    border-color: var(--accent-color);
}

/* Grouped Council List Element Tree */
#council-list-container {
    flex-grow: 1;
    overflow-y: auto;
    border-top: 1px solid var(--border-color);
    margin-top: 10px;
    padding-right: 5px;
}

.council-group {
    margin-top: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.council-header {
    font-weight: bold;
    font-size: 12px;
    color: var(--accent-color);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.suburb-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.suburb-tag {
    background: #198754;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    animation: tagPop 0.2s ease-out;
}

@keyframes tagPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Overlay Modal View Engine Blocks */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-overlay.hidden { display: none; }
.modal-content.hidden { display: none; }

.modal-content {
    background: var(--bg-panel);
    color: var(--text-main);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 440px;
    width: 90%;
    border: 1px solid var(--border-color);
    animation: modalPop 0.25s ease-out;
    box-sizing: border-box;
}

@keyframes modalPop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.modal-actions button, #btn-modal-close {
    padding: 10px 20px;
    font-size: 15px;
    font-weight: bold;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}

#btn-modal-close { 
    background: var(--accent-color); 
    color: white; 
    width: 100%;
    box-sizing: border-box;
}

.modal-stats-summary {
    display: flex;
    justify-content: space-around;
    background: var(--bg-body);
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid var(--border-color);
}

.modal-stats-summary strong { font-size: 22px; }