* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a1a;
    color: #e0e0e0;
    overflow: hidden;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    height: 100vh;
    padding: 20px;
}

#gameContainer {
    display: flex;
    gap: 20px;
    width: 100%;
    height: 100%;
    align-items: flex-start;
}

#rightPanel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 0 0 350px;
}

#gameInfoSection {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#gameInfoSection h1,
#robotSection h1 {
    font-size: 18px;
    font-weight: bold;
    color: #e0e0e0;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#gameInfoGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

#messagesSection {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px 20px;
    border-radius: 5px;
    border: 1px solid #444;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    min-height: 200px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
}

#messagesLabel {
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#messagesContent {
    flex: 1;
    overflow-y: auto;
    font-size: 14px;
    color: #e0e0e0;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#robotSection {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#robotGrid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

#robotMetrics {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.metric {
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 15px;
    border-radius: 5px;
    border: 1px solid #444;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 80px;
}

.metricLabel {
    font-size: 12px;
    color: #888;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.metricValue {
    font-size: 32px;
    font-weight: bold;
    color: #ffffff;
    line-height: 1;
}

#fieldContainer {
    flex: 0 0 auto;
    background: #0f0f0f;
    border: 2px solid #333;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    overflow: hidden;
}

#gameCanvas {
    display: block;
    background: #2a2a2a;
}

#startButtonBox {
    flex: 0 0 auto;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px 20px;
    border-radius: 5px;
    border: 1px solid #444;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

#startButton {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

#startButton:hover {
    background: #45a049;
}

#startButton:disabled {
    background: #666;
    cursor: not-allowed;
}

#gameTimerBox {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px 20px;
    border-radius: 5px;
    border: 1px solid #444;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 120px;
    grid-column: 1 / -1;
}

#gameTimerLabel {
    font-size: 12px;
    color: #888;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#gameTimerValue {
    font-size: 36px;
    font-weight: bold;
    color: #4CAF50;
    line-height: 1;
}


#status {
    color: #4CAF50;
}

#controllerStatus {
    color: #ff6b6b;
}

#controllerStatus.connected {
    color: #4CAF50;
}

#intakeBox {
    background: rgba(0, 0, 0, 0.8); /* Default background when off */
    padding: 8px 20px;
    border-radius: 5px;
    border: 1px solid #444;
    font-size: 14px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: background 0.3s;
}

#intakeBox.active.red {
    background: #FF4444; /* Bright red when active */
}

#intakeBox.active.blue {
    background: #4444FF; /* Bright blue when active */
}

#shooterBox {
    background: rgba(0, 0, 0, 0.8); /* Default background when off */
    padding: 8px 20px;
    border-radius: 5px;
    border: 1px solid #444;
    font-size: 14px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: background 0.3s;
}

#shooterBox.active.red {
    background: #FF4444; /* Bright red when active */
}

#shooterBox.active.blue {
    background: #4444FF; /* Bright blue when active */
}

#shooterLabel {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s;
}

#shooterBox.active #shooterLabel {
    color: #ffffff;
}

#intakeLabel {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s;
}

#intakeBox.active #intakeLabel {
    color: #ffffff;
}

#ballCountBox {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px 20px;
    border-radius: 5px;
    border: 1px solid #444;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#ballCountLabel {
    font-size: 12px;
    color: #888;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#ballCountValue {
    font-size: 48px; /* 200% larger than normal (24px * 2) */
    font-weight: bold;
    color: #FFD700;
    line-height: 1;
}

#ballCountMax {
    font-size: 14px;
    color: #888;
    margin-top: 5px;
}

#redScoreBox {
    background: rgba(68, 17, 17, 0.8); /* Dark red tinged background */
    padding: 15px 20px;
    border-radius: 5px;
    border: 1px solid #444;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: background 0.3s;
}

#redScoreBox.active {
    background: #FF4444; /* Bright red when hub is active */
}

#redScoreLabel {
    font-size: 12px;
    color: #888;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s;
}

#redScoreBox.active #redScoreLabel {
    color: #ffffff;
}

#redScoreValue {
    font-size: 48px;
    font-weight: bold;
    color: #ffffff;
    line-height: 1;
}

#blueScoreBox {
    background: rgba(17, 17, 68, 0.8); /* Dark blue tinged background */
    padding: 15px 20px;
    border-radius: 5px;
    border: 1px solid #444;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: background 0.3s;
}

#blueScoreBox.active {
    background: #4444FF; /* Bright blue when hub is active */
}

#blueScoreLabel {
    font-size: 12px;
    color: #888;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s;
}

#blueScoreBox.active #blueScoreLabel {
    color: #ffffff;
}

#blueScoreValue {
    font-size: 48px;
    font-weight: bold;
    color: #ffffff;
    line-height: 1;
}

/* Lobby Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #2a2a2a;
    padding: 30px;
    border-radius: 10px;
    border: 2px solid #444;
    min-width: 300px;
    text-align: center;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #e0e0e0;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    font-size: 16px;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 5px;
    color: #e0e0e0;
    box-sizing: border-box;
}

.modal-content button {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: bold;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.modal-content button:hover {
    background: #45a049;
}

/* Game Over Modal */
.game-over-content {
    max-width: 800px;
    min-width: 600px;
}

.game-over-winner {
    font-size: 48px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 30px;
    text-transform: uppercase;
}

.game-over-winner.red {
    color: #FF4444;
}

.game-over-winner.blue {
    color: #4444FF;
}

.final-scores {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.final-score-box {
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 3px solid;
}

.final-score-box.red-score {
    background: rgba(68, 17, 17, 0.8);
    border-color: #FF4444;
}

.final-score-box.blue-score {
    background: rgba(17, 17, 68, 0.8);
    border-color: #4444FF;
}

.final-score-label {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.final-score-box.red-score .final-score-label {
    color: #FF4444;
}

.final-score-box.blue-score .final-score-label {
    color: #4444FF;
}

.final-score-value {
    font-size: 72px;
    font-weight: bold;
    color: #ffffff;
    line-height: 1;
}

.game-over-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.metrics-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    overflow: hidden;
}

.metrics-table th {
    padding: 12px;
    text-align: left;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid;
}

.metrics-table.red-table th {
    background: rgba(255, 68, 68, 0.2);
    color: #FF4444;
    border-bottom-color: #FF4444;
}

.metrics-table.blue-table th {
    background: rgba(68, 68, 255, 0.2);
    color: #4444FF;
    border-bottom-color: #4444FF;
}

.metrics-table td {
    padding: 10px 12px;
    font-size: 14px;
    color: #e0e0e0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.metrics-table tr:last-child td {
    border-bottom: none;
}

.metrics-table .robot-id {
    font-weight: bold;
    color: #FFD700;
}

.metrics-table.red-table .robot-id {
    color: #FFAAAA;
}

.metrics-table.blue-table .robot-id {
    color: #AAAAFF;
}

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.hidden {
    display: none !important;
}

.screen.hidden {
    display: none !important;
}

.modal.hidden {
    display: none !important;
}

.screen-content {
    background: #2a2a2a;
    padding: 30px;
    border-radius: 10px;
    border: 2px solid #444;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.screen-content h2 {
    margin-bottom: 20px;
    color: #e0e0e0;
    text-align: center;
}

.primary-button {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
    margin-bottom: 20px;
}

.primary-button:hover {
    background: #45a049;
}

.game-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.game-item {
    background: #1a1a1a;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-info {
    flex: 1;
}

.game-id {
    font-size: 18px;
    font-weight: bold;
    color: #e0e0e0;
    margin-bottom: 5px;
}

.game-status {
    font-size: 14px;
    color: #888;
    margin-bottom: 5px;
}

.game-players {
    font-size: 12px;
    color: #666;
}

.join-button {
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.join-button:hover {
    background: #1976D2;
}

.empty-message {
    text-align: center;
    color: #888;
    padding: 40px;
    font-size: 16px;
}

.lobby-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    margin-bottom: 20px;
}

.player-list-container h3,
.team-selection-container h3 {
    margin-bottom: 15px;
    color: #e0e0e0;
}

.player-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-item {
    background: #1a1a1a;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-name {
    font-weight: bold;
    color: #e0e0e0;
}

.player-position {
    font-size: 12px;
    color: #888;
}

.team-selection-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.team-section {
    background: #1a1a1a;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #444;
}

.team-section h3 {
    margin-bottom: 15px;
    text-align: center;
}

.team-red h3 {
    color: #FF4444;
}

.team-blue h3 {
    color: #4444FF;
}

.team-slots {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-slot {
    padding: 15px;
    border-radius: 5px;
    border: 2px solid #444;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.team-slot.available {
    background: #2a2a2a;
    border-color: #666;
    color: #888;
}

.team-slot.available:hover {
    background: #333;
    border-color: #888;
    color: #aaa;
}

.team-slot.filled {
    background: #1a1a1a;
    border-color: #555;
    cursor: default;
}

.slot-empty {
    color: #888;
}

.slot-filled {
    color: #e0e0e0;
}

.slot-robot-number {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
    color: #4CAF50;
}

.slot-filled .slot-robot-number {
    color: #FFD700;
}

.slot-player-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.slot-you {
    font-size: 12px;
    color: #4CAF50;
    font-style: italic;
}

/* Countdown Overlay */
.countdown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.countdown-overlay.hidden {
    display: none;
}

.countdown-value {
    font-size: 120px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
}

.countdown-shift-info {
    font-size: 24px;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}
