.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  overflow: auto;
}

.modal-content {
  background-color: #1e1e1e;
  margin: 2% auto;
  padding: 20px;
  border-radius: 8px;
  width: 95%;
  max-width: 1400px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  color: white;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #444;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.btn-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
}

.screen-container {
  position: relative;
  background: black;
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 700px;
}

#live-screen {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 80vh;
  cursor: crosshair;
  background: black;
  display: block;
  object-fit: contain;
}

#live-screen.view-only {
  cursor: default;
}

.loading-overlay, .error-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(30, 30, 30, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
  font-size: 1.2em;
}

.loading-overlay .spinner {
  border: 4px solid rgba(255,255,255,0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg);}
  100% { transform: rotate(360deg);}
}

.control-panel {
  background: #2a2a2a;
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: flex-start;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ccc;
}

.control-group label {
  min-width: 60px;
}

.btn-mode {
  padding: 8px 16px;
  border: 2px solid #444;
  background-color: #333;
  color: white;
  cursor: pointer;
  border-radius: 4px;
  user-select: none;
}

.btn-mode.active {
  border-color: #4caf50;
  background-color: #4caf50;
}

.control-group select {
  background-color: #333;
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.control-group button {
  background-color: #444;
  color: white;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.control-group button:hover {
  background-color: #555;
}

.stats {
  color: white;
  font-size: 0.9em;
  white-space: nowrap;
  display: flex;
  gap: 20px;
}
