body {
  background-color: #1a1a2e;
  color: white;
  font-family: sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  margin: 0;
  padding: 16px 0;
  box-sizing: border-box;
}

/* --- Join screen --- */

#join-screen {
  text-align: center;
  margin-top: 10vh;
}

#join-screen input {
  padding: 8px;
  font-size: 16px;
  margin-right: 8px;
}

#join-screen button {
  padding: 8px 16px;
  font-size: 16px;
  cursor: pointer;
}

/* --- Game view --- */

#game-view {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
}

#game-layout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

#game-center {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#status-bar {
  font-size: 15px;
  margin-bottom: 6px;
  text-align: center;
}

#gm-status {
  color: #aaa;
  font-size: 13px;
}

/* --- Canvas --- */

#canvas-wrapper {
  position: relative;
}

canvas {
  display: block;
}

/* --- Spectator overlay --- */

#spectator-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.80);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: white;
  font-size: 18px;
  padding: 30px;
  box-sizing: border-box;
  line-height: 1.7;
  border: 2px solid white;
}

/* --- Game controls bar --- */

#game-controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

#game-controls button {
  padding: 7px 16px;
  font-size: 14px;
  cursor: pointer;
  background: #2c3e50;
  color: white;
  border: 1px solid #555;
  border-radius: 4px;
}

#game-controls button:hover:not(:disabled) {
  background: #34495e;
}

#game-controls button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* --- Side panels --- */

#gm-left  { width: 250px; }   /* invite codes */
#players-panel { width: 290px; } /* player list — needs room for long names */

.side-panel {
  width: 200px;
  background: #16213e;
  border: 1px solid #444;
  border-radius: 6px;
  overflow: hidden;
  flex-direction: column;
  flex-shrink: 0;
  align-self: flex-start;
}

.panel-header {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  cursor: pointer;
  background: #0f3460;
  user-select: none;
  gap: 6px;
}

.panel-title {
  flex: 1;
  font-weight: bold;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.collapse-arrow {
  font-size: 10px;
  color: #aaa;
}

.panel-action-btn {
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
  background: #2c3e50;
  color: white;
  border: 1px solid #555;
  border-radius: 3px;
  margin-right: 18px; /* keep well away from the collapse arrow */
}

.panel-action-btn:hover {
  background: #34495e;
}

.panel-body {
  padding: 8px;
  overflow-y: auto;
  max-height: 570px;
}

.panel-body.collapsed {
  display: none;
}

/* --- Invite codes --- */

.gm-code-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 0;
  font-size: 13px;
  font-family: monospace;
}

.team-name-label {
  cursor: pointer;
  border-bottom: 1px dashed #555;
}

.team-name-label:hover {
  border-bottom-color: #aaa;
}

.team-name-input {
  width: 80px;
  font-size: 13px;
  font-family: monospace;
  background: #1a1a2e;
  color: white;
  border: 1px solid #aaa;
  border-radius: 2px;
  padding: 1px 3px;
}

.code-value {
  color: #aaa;
}

.gm-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.gm-dot-red      { background: #e74c3c; }
.gm-dot-blue     { background: #3498db; }
.gm-dot-green    { background: #2ecc71; }
.gm-dot-white    { background: #ffffff; }
.gm-dot-purple   { background: #9b59b6; }
.gm-dot-orange   { background: #e67e22; }
.gm-dot-OD       { background: #f9ca24; border-color: rgba(255,255,255,0.3); }
.gm-dot-disabled { background: #444; border-color: #666; }

/* --- Player sections --- */

.player-section-title {
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #aaa;
  margin: 6px 0 3px;
}

.od-title {
  color: #f9ca24;
}

.od-summary {
  color: #f9ca24;
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000;
}

.gm-player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 2px;
  gap: 4px;
}

.player-info {
  font-size: 11px;
  color: #ccc;
  word-break: break-all;
  flex: 1;
}

/* --- Team dropdowns (2-column grid) --- */

#gm-od-section,
#gm-pending-section {
  margin-bottom: 4px;
}

#gm-team-dropdowns {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.team-dropdown {
  min-width: 0;
}

.team-summary {
  font-weight: bold;
  font-size: 12px;
  padding: 4px 5px;
  cursor: pointer;
  list-style: none;
  border-radius: 3px;
  user-select: none;
  /* Black outline on text so all team colors are readable, including white */
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000;
}

.team-summary::-webkit-details-marker { display: none; }
.team-summary::marker { display: none; }

.team-summary-red    { color: #e74c3c; }
.team-summary-blue   { color: #3498db; }
.team-summary-green  { color: #2ecc71; }
.team-summary-white  { color: #ffffff; }
.team-summary-purple { color: #9b59b6; }
.team-summary-orange { color: #e67e22; }

.team-dropdown .gm-player-row {
  padding: 2px 2px;
}

.gm-empty {
  font-size: 11px;
  color: #555;
  font-style: italic;
  padding: 2px 4px;
}

/* --- Kick toast --- */

#gm-kick-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #c0392b;
  color: white;
  padding: 8px 18px;
  border-radius: 4px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 1000;
  white-space: nowrap;
}

/* --- Kicked overlay --- */

#kicked-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

#kicked-msg {
  background: #c0392b;
  color: white;
  padding: 28px 48px;
  border-radius: 8px;
  font-size: 22px;
  font-weight: bold;
  text-align: center;
}

/* --- Cooldown panel --- */


.cd-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  font-size: 12px;
  font-family: monospace;
}

.cd-label {
  flex: 1;
  font-weight: bold;
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000;
}

.cd-bar-wrap {
  width: 60px;
  height: 8px;
  background: #333;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.cd-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.25s linear;
}

.cd-value {
  width: 30px;
  text-align: right;
  color: #ccc;
  flex-shrink: 0;
}

.cd-divider {
  border: none;
  border-top: 1px solid #333;
  margin: 4px 0;
}

/* --- Server disconnect overlay --- */

#disconnect-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

#disconnect-msg {
  background: #2c3e50;
  color: white;
  padding: 28px 48px;
  border-radius: 8px;
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  border: 2px solid #555;
}

/* --- Branding --- */

#branding {
  position: fixed;
  bottom: 10px;
  left: 12px;
  z-index: 100;
  pointer-events: none;
  user-select: none;
}

#branding-title {
  font-size: 13px;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 1px;
  text-transform: uppercase;
}

#branding-copy {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.22);
  margin-top: 2px;
}

/* --- Kick button --- */

.gm-kick-btn {
  padding: 1px 6px;
  font-size: 11px;
  cursor: pointer;
  background: #c0392b;
  color: white;
  border: none;
  border-radius: 3px;
  flex-shrink: 0;
}

.gm-kick-btn:hover {
  background: #e74c3c;
}
