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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#cesiumContainer {
  width: 100%;
  height: 100%;
}

.auth-panel {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.7);
  padding: 30px;
  border-radius: 10px;
  color: white;
  min-width: 350px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  display: block;
}

.auth-panel.hide {
  display: none;
}

.auth-panel h1 {
  text-align: center;
  margin-bottom: 25px;
  font-size: 28px;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: #e0e0e0;
  font-weight: 500;
  font-size: 14px;
}

.form-group input {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.95);
}

.form-group input:focus {
  outline: none;
  background: white;
  box-shadow: 0 0 8px rgba(102, 126, 234, 0.5);
}

button {
  width: 100%;
  padding: 11px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background 0.3s ease;
}

button:hover {
  background: #5568d3;
}

/* Ensure visually-disabled buttons remain clickable */
button[style*="opacity: 0.5"],
button[style*="opacity: 0"],
.go-live-btn[style*="opacity: 0.5"] {
  pointer-events: auto !important;
  cursor: not-allowed !important;
}

.toggle-btn {
  background: #764ba2;
}

.toggle-btn:hover {
  background: #653a8a;
}

.message {
  margin-top: 12px;
  padding: 10px;
  border-radius: 5px;
  text-align: center;
  display: none;
  font-size: 13px;
}

.message.success {
  background: rgba(76, 175, 80, 0.8);
  color: #fff;
  display: block;
}

.message.error {
  background: rgba(244, 67, 54, 0.8);
  color: #fff;
  display: block;
}

.user-info {
  display: none;
  text-align: center;
}

.user-info.show {
  display: block;
}

.user-info h2 {
  margin-bottom: 15px;
  font-size: 22px;
}

.user-info p {
  margin-bottom: 10px;
  color: #e0e0e0;
  font-size: 13px;
}

.logout-btn {
  background: #dc3545;
  margin-top: 15px;
}

.logout-btn:hover {
  background: #c82333;
}

.controls-panel {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.7);
  padding: 20px;
  border-radius: 10px;
  color: white;
  z-index: 100;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.controls-panel h3 {
  margin-bottom: 12px;
  font-size: 14px;
  text-transform: uppercase;
  color: #e0e0e0;
}

.button-group {
  margin-bottom: 15px;
}

.map-button {
  display: block;
  width: 100%;
  padding: 9px;
  margin-bottom: 8px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s ease;
}

.map-button:hover {
  background: #5568d3;
}

.map-button.active {
  background: #764ba2;
  border-left: 4px solid #ffd700;
}

.toggle-btn-control {
  display: block;
  width: 100%;
  padding: 9px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s ease;
}

.toggle-btn-control:hover {
  background: #5568d3;
}

.toggle-btn-control.active {
  background: #4caf50;
}

.settings-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid #667eea;
  padding: 30px;
  border-radius: 10px;
  color: white;
  z-index: 2000;
  min-width: 400px;
  display: none;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.settings-panel.show {
  display: flex;
}

.settings-panel h2 {
  text-align: center;
  margin: 0;
  font-size: 24px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-group label {
  font-weight: 600;
  color: #e0e0e0;
  font-size: 14px;
}

.settings-group input,
.settings-group select {
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #667eea;
  border-radius: 5px;
  color: white;
  font-size: 14px;
}

.settings-group input:focus,
.settings-group select:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.settings-group select {
  cursor: pointer;
}

.settings-group select option {
  background: #333;
  color: white;
}

.settings-buttons {
  display: flex;
  gap: 10px;
}

.settings-buttons button {
  flex: 1;
  padding: 11px;
}

.btn-cancel {
  background: #666;
}

.btn-cancel:hover {
  background: #555;
}

.btn-start {
  background: #00aa00;
}

.btn-start:hover:not(:disabled) {
  background: #008800;
}

.btn-start:disabled {
  background: #666;
  color: #999;
  cursor: not-allowed;
  opacity: 0.6;
}

.credential-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.credential-row label {
  color: #e0e0e0;
  font-size: 13px;
  font-weight: 600;
}

.credential-row input {
  padding: 10px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #667eea;
  border-radius: 4px;
  color: white;
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

.terms-container {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(102, 126, 234, 0.5);
  border-radius: 5px;
  max-height: 200px;
  overflow-y: auto;
  padding: 15px;
  font-size: 12px;
  line-height: 1.5;
  color: #ccc;
}

.terms-container::-webkit-scrollbar {
  width: 8px;
}

.terms-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.terms-container::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.6);
  border-radius: 4px;
}

.terms-container::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 126, 234, 0.8);
}

.terms-checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 15px;
  padding: 12px;
  background: rgba(102, 126, 234, 0.1);
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 5px;
}

.terms-checkbox-group input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.terms-checkbox-group label {
  margin: 0;
  font-size: 13px;
  color: #e0e0e0;
  cursor: pointer;
  line-height: 1.4;
}

.stream-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
}

.stream-modal.show {
  display: flex;
}

.stream-modal-content {
  background: black;
  padding: 20px;
  border-radius: 10px;
  max-width: 800px;
  max-height: 90vh;
  position: relative;
}

.stream-window {
  position: fixed;
  background: black;
  border: 2px solid #667eea;
  border-radius: 10px;
  padding: 0;
  min-width: 300px;
  min-height: 300px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  align-items: stretch;
}

.stream-window::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, #667eea 50%);
  pointer-events: auto;
  border-radius: 0 0 8px 0;
}

.stream-window-header {
  background: #333;
  color: white;
  padding: 10px;
  cursor: move;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px 8px 0 0;
  user-select: none;
  font-size: 12px;
  font-weight: bold;
}

.stream-window-header:active {
  background: #444;
}

.stream-window-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stream-window-controls {
  display: flex;
  gap: 5px;
}

.close-stream {
  background: #ff4444;
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-stream:hover {
  background: #dd0000;
}

.stream-window.fullscreen .close-stream {
  position: fixed;
  width: 44px;
  height: 44px;
  font-size: 20px;
  background: #667eea;
  border-radius: 4px;
  top: 10px;
  right: 10px;
  z-index: 201;
  border: none;
  display: flex !important;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  padding: 0;
  margin: 0;
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  transition: background 0.2s ease, transform 0.2s ease;
}

.stream-window.fullscreen .close-stream:hover {
  background: #5568d3;
}

.stream-window.fullscreen .close-stream:active {
  background: #5568d3;
  transform: scale(0.95);
}

/* Hide close button in header on mobile - will use footer button instead */
@media (max-width: 768px) {
  .stream-window.fullscreen .close-stream {
    display: none !important;
  }
}

.stream-window.fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  left: 0 !important;
  top: 0 !important;
  border-radius: 0 !important;
  z-index: 200 !important;
  min-width: unset !important;
  min-height: unset !important;
}

.stream-window.fullscreen .stream-window-header {
  display: none !important;
  border-radius: 0;
}

.stream-window.fullscreen .stream-video-container {
  width: 100%;
  height: 100%;
}

.stream-window.fullscreen .chat-btn {
  display: flex !important;
  z-index: 201;
}

.controls-panel.hidden {
  display: none !important;
}

.stream-video-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stream-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 4px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-status-text {
  color: #ccc;
  margin-top: 15px;
  font-size: 14px;
  text-align: center;
}

#liveVideo {
  width: 100%;
  max-width: 700px;
  border-radius: 5px;
  background: #000;
}

.stream-info {
  color: white;
  margin-top: 15px;
  font-size: 14px;
}

.go-live-btn {
  width: 100%;
  padding: 11px;
  background: #ff4444;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background 0.3s ease;
}

.go-live-btn:hover:not(:disabled) {
  background: #dd0000;
}

.go-live-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #ff4444;
}

.go-live-btn.streaming {
  background: #00aa00;
}

.go-live-btn.streaming:hover {
  background: #008800;
}

.map-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#loginForm, #registerForm {
  display: none;
}

#loginForm.show, #registerForm.show {
  display: block;
}

.live-streams-counter {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  padding: 15px 25px;
  border-radius: 10px;
  color: white;
  font-weight: 600;
  font-size: 14px;
  z-index: 99;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-streams-counter .count {
  font-size: 20px;
  color: #667eea;
  font-weight: bold;
}

.zoom-icon-btn {
  position: absolute;
  bottom: calc(27vh + 5px);
  left: 20px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 5px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, transform 0.2s ease;
  padding: 0;
  z-index: 99;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.zoom-icon-btn:hover:not(:disabled) {
  background: #5568d3;
  transform: scale(1.15);
}

.zoom-icon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== CHAT STYLES ===== */
.stream-content {
  display: flex;
  flex: 1 1 100%;
  overflow: hidden;
  gap: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
}

.stream-window.chat-hidden .stream-content {
  flex-direction: column;
}

.stream-window.chat-visible .stream-content {
  flex-direction: row;
}

.stream-video-wrapper {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 300px;
}

.stream-divider {
  width: 8px;
  background: linear-gradient(90deg, #1a1a1a 0%, #667eea 50%, #1a1a1a 100%);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 0.2s ease;
  display: none;
}

.stream-window.chat-visible .stream-divider {
  display: block;
}

.stream-divider:hover {
  background: linear-gradient(90deg, #1a1a1a 0%, #ffcc00 50%, #1a1a1a 100%);
}

.chat-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 16px;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .chat-btn {
    width: 44px;
    height: 44px;
    font-size: 20px;
    top: 10px;
    right: 10px;
    background: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  }

  .chat-btn:active {
    background: #5568d3;
    transform: scale(0.95);
  }
}

.chat-btn:hover {
  background: #5568d3;
}

.stream-window .chat-btn.hidden {
  display: none;
}

.chat-panel {
  flex: 0 0 300px;
  background: #1a1a1a;
  border-left: 2px solid #667eea;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stream-window.chat-hidden .chat-panel {
  display: none;
}

.chat-panel.detached {
  position: fixed;
  border: 2px solid #667eea;
  border-left: 2px solid #667eea;
  border-radius: 10px;
  width: 350px;
  height: 450px;
  background: #000;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  cursor: move;
  z-index: 105;
  overflow: hidden;
}

.chat-panel.detached::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, #667eea 50%);
  pointer-events: auto;
  border-radius: 0 0 8px 0;
}

.chat-panel.floating {
  position: fixed;
  bottom: 150px;
  right: 10px;
  width: 280px;
  height: 350px;
  background: #000;
  border: 2px solid #667eea;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 102;
  cursor: move;
}

.chat-panel.hidden {
  display: none !important;
}

.chat-header {
  background: #333;
  color: white;
  padding: 10px;
  border-bottom: 1px solid #667eea;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  font-size: 14px;
  user-select: none;
  cursor: move;
  min-height: 40px;
}

.chat-header-controls {
  display: flex;
  gap: 5px;
}

.chat-btn-small {
  background: transparent;
  color: white;
  border: 1px solid #667eea;
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.chat-btn-small:hover {
  background: #667eea;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #1a1a1a;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #5568d3;
}

.chat-message {
  background: #333;
  color: #fff;
  padding: 8px;
  border-radius: 4px;
  font-size: 13px;
  word-wrap: break-word;
}

.chat-message.own {
  background: #667eea;
  text-align: right;
}

.chat-message-name {
  font-weight: bold;
  color: #ffcc00;
  font-size: 12px;
  margin-bottom: 2px;
}

.chat-message-text {
  word-break: break-word;
}

.chat-input-area {
  padding: 10px;
  border-top: 1px solid #667eea;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-login-notice {
  color: #ffcc00;
  font-size: 12px;
  text-align: center;
  padding: 10px;
}

.chat-input {
  width: 100%;
  padding: 8px;
  background: #333;
  color: white;
  border: 1px solid #667eea;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Segoe UI', sans-serif;
  resize: none;
  max-height: 60px;
}

.chat-input:focus {
  outline: none;
  border-color: #ffcc00;
  background: #444;
}

.chat-input:disabled {
  background: #222;
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-send-btn {
  width: 100%;
  padding: 8px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.2s ease;
}

.chat-send-btn:hover:not(:disabled) {
  background: #5568d3;
}

.chat-send-btn:disabled {
  background: #444;
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .stream-window .stream-content {
    flex-direction: column;
  }

  .stream-window .chat-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    max-height: 45%;
    min-height: 80px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    border: none;
    border-top: 2px solid #667eea;
    border-radius: 0;
    z-index: 102;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.95);
  }

  .stream-window .chat-panel.hidden {
    display: none !important;
  }

  .stream-window .chat-header {
    background: #333;
    color: white;
    padding: 8px;
    border-bottom: 1px solid #667eea;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 13px;
    user-select: none;
    cursor: move;
    min-height: 35px;
    flex-shrink: 0;
  }

  .stream-window .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    max-height: 200px;
  }

  .stream-window .chat-input-area {
    flex-shrink: 0;
    padding: 8px;
    border-top: 1px solid #667eea;
    background: #0a0a0a;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 50px;
  }

  .stream-window .chat-input {
    padding: 6px;
    font-size: 12px;
  }

  .stream-window .chat-send-btn {
    padding: 6px;
    font-size: 12px;
  }

  .stream-window .chat-panel.detached {
    position: fixed;
    bottom: 50px;
    right: 10px;
    left: auto;
    width: 90vw;
    max-width: 400px;
    height: 350px;
    border: 2px solid #667eea;
    border-radius: 10px;
    background: #000;
  }

  .stream-window .chat-panel.floating {
    position: fixed;
    bottom: 0;
    right: 0;
    left: auto;
    width: 100%;
    height: auto;
    max-height: 300px;
    border-radius: 10px 10px 0 0;
    z-index: 102;
  }

  .stream-window.fullscreen .chat-panel {
    width: 100%;
    height: auto;
    max-height: 35vh;
  }

  .stream-window.fullscreen .chat-messages {
    max-height: calc(35vh - 100px);
  }
}

/* ===== MOBILE RESPONSIVE STYLES ===== */

/* Tablet devices (768px and below) */
@media (max-width: 768px) {
  .auth-panel {
    min-width: auto;
    width: 90vw;
    max-width: 400px;
    padding: 20px;
    left: 5vw !important;
    top: 50% !important;
    transform: translateY(-50%);
    max-height: 90vh;
  }

  .auth-panel h1 {
    font-size: 24px;
    margin-bottom: 20px;
  }

  .form-group input {
    padding: 12px;
    font-size: 16px;
  }

  button {
    padding: 14px;
    font-size: 16px;
    min-height: 48px;
  }

  .settings-panel {
    min-width: auto;
    width: 90vw;
    max-width: 500px;
    padding: 20px;
    transform: translate(-50%, -50%);
  }

  .settings-panel h2 {
    font-size: 20px;
  }

  .controls-panel {
    width: calc(100vw - 20px);
    left: 10px !important;
    right: 10px;
    bottom: 10px;
    padding: 15px;
    height: 17vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }

  .controls-panel h3 {
    font-size: 13px;
    margin-bottom: 10px;
  }

  .button-group {
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .map-button {
    padding: 14px;
    font-size: 15px;
    min-height: 56px;
  }

  .live-streams-counter {
    bottom: calc(17vh + 5px);
    right: 15px;
    padding: 12px 20px;
    font-size: 13px;
  }

  .live-streams-counter .count {
    font-size: 18px;
  }

  .zoom-icon-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    font-size: 16px;
    bottom: calc(17vh + 5px);
    left: 15px;
  }

  .stream-window {
    width: 100vw !important;
    height: 83vh !important;
    left: 0 !important;
    top: 0 !important;
    border-radius: 0;
    min-width: unset;
    min-height: unset;
  }
}

/* Large phones (480px to 768px) */
@media (max-width: 480px) {
  .auth-panel {
    width: 95vw;
    max-width: none;
    padding: 15px;
    left: 2.5vw !important;
  }

  .auth-panel h1 {
    font-size: 20px;
    margin-bottom: 15px;
  }

  .form-group {
    margin-bottom: 12px;
  }

  .form-group label {
    font-size: 13px;
    margin-bottom: 4px;
  }

  .form-group input {
    padding: 10px;
    font-size: 16px;
    border-radius: 4px;
  }

  button {
    padding: 12px;
    font-size: 15px;
    min-height: 44px;
    border-radius: 4px;
  }

  .user-info h2 {
    font-size: 18px;
    margin-bottom: 10px;
  }

  .user-info p {
    font-size: 12px;
  }

  .message {
    font-size: 12px;
    padding: 8px;
  }

  .settings-panel {
    width: 95vw;
    max-width: none;
    padding: 15px;
    gap: 15px;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
  }

  .settings-panel h2 {
    font-size: 18px;
  }

  .settings-group label {
    font-size: 13px;
  }

  .settings-group input,
  .settings-group select {
    padding: 10px;
    font-size: 16px;
  }

  .settings-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .settings-buttons button {
    padding: 12px;
  }

  .controls-panel {
    width: 100vw;
    left: 0 !important;
    right: 0;
    bottom: 0;
    padding: 15px;
    height: 17vh;
    overflow-y: auto;
    border-radius: 10px 10px 0 0;
    display: flex;
    flex-direction: column;
  }

  .controls-panel h3 {
    font-size: 13px;
    margin-bottom: 10px;
  }

  .button-group {
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    flex: 1;
  }

  .map-button {
    padding: 12px;
    font-size: 13px;
    min-height: 50px;
    margin-bottom: 0;
  }

  .toggle-btn-control {
    padding: 12px;
    font-size: 13px;
    min-height: 50px;
  }

  .go-live-btn {
    padding: 14px;
    font-size: 15px;
    min-height: 50px;
  }

  .live-streams-counter {
    bottom: calc(17vh + 5px);
    right: 12px;
    padding: 10px 15px;
    font-size: 12px;
  }

  .live-streams-counter .count {
    font-size: 16px;
  }

  .zoom-icon-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    font-size: 14px;
    bottom: calc(17vh + 5px);
    left: 12px;
  }

  .stream-window {
    width: 100vw !important;
    height: 83vh !important;
    left: 0 !important;
    top: 0 !important;
    border-radius: 0;
    min-width: unset;
    min-height: unset;
  }

  .stream-window-header {
    padding: 8px;
    font-size: 11px;
  }

  .close-stream {
    width: 22px;
    height: 22px;
  }

  /* Override fullscreen button styling on mobile */
  .stream-window.fullscreen .close-stream {
    position: fixed !important;
    width: 44px !important;
    height: 44px !important;
    font-size: 20px !important;
    background: #667eea !important;
    border-radius: 4px !important;
    top: 10px !important;
    right: 10px !important;
    z-index: 201 !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
    transition: background 0.2s ease, transform 0.2s ease !important;
  }

  .stream-window.fullscreen .close-stream:hover {
    background: #5568d3 !important;
  }

  .stream-window.fullscreen .close-stream:active {
    background: #5568d3 !important;
    transform: scale(0.95) !important;
  }

  #liveVideo {
    max-width: 100%;
  }
}

/* Small phones (375px and below) */
@media (max-width: 375px) {
  .auth-panel {
    width: 95vw;
    padding: 12px;
  }

  .auth-panel h1 {
    font-size: 18px;
    margin-bottom: 12px;
  }

  .form-group {
    margin-bottom: 10px;
  }

  .form-group label {
    font-size: 12px;
  }

  .form-group input {
    padding: 10px;
    font-size: 16px;
  }

  button {
    padding: 11px;
    font-size: 14px;
    min-height: 44px;
  }

  .user-info h2 {
    font-size: 16px;
  }

  .settings-panel {
    width: 95vw;
    padding: 12px;
    gap: 12px;
  }

  .settings-group input,
  .settings-group select {
    padding: 10px;
    font-size: 16px;
  }

  .controls-panel {
    width: 100vw;
    left: 0 !important;
    right: 0;
    bottom: 0;
    padding: 12px;
    height: 17vh;
    border-radius: 10px 10px 0 0;
  }

  .button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .map-button {
    padding: 11px;
    font-size: 12px;
    min-height: 48px;
    margin-bottom: 0;
    flex: 1;
  }

  .toggle-btn-control {
    padding: 11px;
    font-size: 12px;
    min-height: 48px;
  }

  .go-live-btn {
    padding: 12px;
    font-size: 13px;
    min-height: 48px;
  }

  .zoom-icon-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    font-size: 12px;
    bottom: calc(17vh + 5px);
    left: 12px;
  }
}

/* Portrait orientation for mobile fullscreen streaming */
@media (orientation: portrait) and (max-width: 768px) {
  .stream-window.fullscreen {
    width: 100vw !important;
    height: 100vh !important;
  }

  .stream-window.fullscreen .stream-video-container {
    width: 100%;
    height: 100%;
  }

  .stream-window.fullscreen .stream-video {
    width: 100%;
    height: 100%;
  }
}

/* Floating viewer counter for mobile streaming */
.mobile-viewer-badge {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(102, 126, 234, 0.95);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 14px;
  z-index: 10000;
  display: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.mobile-viewer-badge.visible {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-viewer-badge .viewer-count {
  font-size: 16px;
  font-weight: bold;
  min-width: 24px;
  text-align: center;
}

.live-streams-counter.no-streams {
  color: #999;
}

.live-streams-counter.no-streams .count {
  color: #666;
}

/* Top-left auth button */
.auth-button {
  position: fixed;
  top: 20px;
  left: 20px;
  padding: 10px 16px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  z-index: 100;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  width: auto;
  white-space: nowrap;
}

.auth-button:hover {
  background: #5568d3;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.auth-button:active {
  transform: scale(0.98);
}

/* Profile modal */
.profile-modal {
  display: none;
  position: fixed;
  top: 60px;
  left: 20px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 20px;
  min-width: 280px;
  max-width: 350px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  z-index: 101;
  color: white;
  overflow: hidden;
}

.profile-modal.show {
  display: block;
}

.profile-modal h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: #667eea;
}

.profile-modal p {
  margin: 8px 0;
  font-size: 14px;
  color: #ccc;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.profile-modal p strong {
  color: #fff;
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 4px;
}

.profile-modal input {
  box-sizing: border-box;
  max-width: 100%;
}

.profile-modal input:focus {
  outline: none;
  border-color: #667eea;
  background: #333;
}

.profile-modal .logout-btn {
  width: 100%;
  margin-top: 16px;
  padding: 10px;
  background: #e50914;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.profile-modal .logout-btn:hover {
  background: #cc0812;
}

/* Welcome Panel Styles */
.welcome-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.welcome-content {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  background-color: #1a1a2e;
  border: 1px solid #667eea;
  border-radius: 12px;
  padding: 40px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(102, 126, 234, 0.2);
  position: relative;
  color: white;
}

.welcome-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  color: #aaa;
  font-size: 24px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.welcome-close:hover {
  background: rgba(102, 126, 234, 0.2);
  color: #667eea;
}

.welcome-panel.hidden {
  display: none;
}

/* Privacy Modal Styles */
.privacy-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease-out;
}

.privacy-modal.hidden {
  display: none;
}

.privacy-content {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  background-color: #1a1a2e;
  border: 1px solid #667eea;
  border-radius: 12px;
  padding: 40px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(102, 126, 234, 0.2);
  position: relative;
  color: white;
}

.privacy-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  font-size: 28px;
  color: #667eea;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.privacy-close:hover {
  background: rgba(102, 126, 234, 0.2);
  color: #667eea;
}

.privacy-text {
  color: #ddd;
  font-size: 15px;
  line-height: 1.8;
}

.privacy-text ul {
  margin: 10px 0;
  padding-left: 25px;
}

.privacy-text li {
  margin: 8px 0;
}

@media (max-width: 768px) {
  .privacy-content {
    padding: 30px 20px;
    max-width: 90%;
    max-height: 90vh;
  }

  .privacy-text {
    font-size: 14px;
  }
}

@media (max-width: 768px) {
  .welcome-content {
    padding: 30px 20px;
    max-width: 90%;
  }

  .welcome-content h2 {
    font-size: 20px !important;
  }

  .welcome-content p {
    font-size: 14px !important;
  }
}
