body {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12pt;
  background-color: #313033;
  color: white;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#appSetup {
  display: none; /* Initial state */
  order: 1;
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

#appSetup h1 {
  margin: 0px;
  font-size: 18pt;
  background-color: rgba(83, 159, 229, 1);
  color: white;
  padding: 10px;
  font-family: Arial, Helvetica, sans-serif;
  height: 35px;
}

#appReconnect {
  order: 1;
  display: flex;
  align-items: center;
}

#appReconnect h1 {
  margin: 0px;
  font-size: 18pt;
  background-color: rgba(83, 159, 229, 1);
  color: white;
  padding: 10px;
  font-family: Arial, Helvetica, sans-serif;
  height: 35px;
}

#appReconnect div {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  margin-left: 20px;
  margin-right: 20px;
}

#appConnecting {
  order: 1;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1;
}

#appConnecting h1 {
  margin: 0px;
  font-size: 18pt;
  background-color: rgba(83, 159, 229, 1);
  color: white;
  padding: 10px;
  font-family: Arial, Helvetica, sans-serif;
  height: 35px;
}

#appStreaming h1 {
  margin: 0px;
  font-size: 18pt;
  background-color: rgba(66, 70, 80, 1);
  color: white;
  padding: 10px;
  font-family: Arial, Helvetica, sans-serif;
  height: 35px;
  position: relative;
  z-index: 1;
}

#appDisconnected h1 {
  margin: 0px;
  font-size: 18pt;
  background-color: rgba(102, 102, 102, 1);
  color: white;
  padding: 10px;
  font-family: Arial, Helvetica, sans-serif;
  height: 35px;
  position: relative;
  z-index: 1;
}

#appError {
  order: 1;
  display: flex;
  align-items: center;
}

#appError h1 {
  margin: 0px;
  font-size: 18pt;
  background-color: rgba(112, 31, 31, 1);
  color: white;
  padding: 10px;
  font-family: Arial, Helvetica, sans-serif;
  height: 35px;
}

#appReconnectError {
  order: 2;
}

.label-cell {
  font-weight: bold;
  padding-right: 10px;
  text-align: right;
}

table td {
  padding: 5px;
}

input[type="text"] {
  padding: 4px;
  width: 200px;
  font-family: sans-serif;
}

#cmdLineJsonInfo,
#envVarsJsonInfo {
  font-size: 11pt;
}

#setupArgs,
#setupEnv {
  overflow: scroll;
}

#setupValidationError {
  margin-top: 1em;
  font-weight: bold;
  color: darkred;
}

#appError h1,
#appReconnectionError h1 {
  background-color: #500;
  padding: 10px;
  font-family: Arial, Helvetica, sans-serif;
  height: 35px;
}

#streamControls {
  position: absolute;
  top: -5px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2;
}

#streamControls button {
  padding: 12pt 0pt 0pt;
}

.stream-controls {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 20px;
  position: relative;
  z-index: 1000;
}

.stream-controls button {
  padding: 8px 12px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.stream-controls button:hover {
  background-color: #45a049;
}

.widget-menu {
  z-index: 3;
  position: relative;
  width: 100%;
}

.widget-options button {
  color: rgb(255, 255, 255);
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
}

.button-separator {
  width: 100%;
  height: 1px;
  background-color: #ccc;
  margin: 8px 0;
}

.widget-options button:hover {
  background-color: #434343;
}

.widget {
  position: absolute;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px;
  border-radius: 5px;
  cursor: move;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 1001;
}

.chart-widget {
  background-color: rgba(0, 0, 0, 0.7);
  border: 1px solid #444;
  border-radius: 5px;
  padding: 10px;
  position: absolute;
  cursor: move;
}

.widget-option {
  padding: 8px 12px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.widget-option:hover {
  background-color: #45a049;
}

.widget-options.open {
  display: block;
}

.widget-options:not(.open) {
  display: none;
}

#appConnecting h1 {
  background-color: #456;
  animation: connectingColorPulse 1s linear alternate-reverse infinite;
}

#appStreaming {
  z-index: 1;
}

#streamVideoElement::-webkit-media-controls {
  display: none !important;
}

@keyframes connectingColorPulse {
  to {
    background-color: #058;
  }
}

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

.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

.default-svg {
  display: block;
}
.hover-svg {
  display: none;
}

button:hover .default-svg {
  display: none;
}
button:hover .hover-svg {
  display: block;
}

button:active .default-svg,
button.active .default-svg {
  display: none;
}
button:active .hover-svg,
button.active .hover-svg {
  display: block;
}

#streamingToggleInput,
#streamingGoFullscreen,
#streamingTerminate,
#addWidgetBtn,
#helpBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background-color: transparent;
  cursor: pointer;
  padding: 0;
}

#streamingToggleInput .default-svg,
#streamingGoFullscreen .default-svg,
#streamingTerminate .default-svg,
#addWidgetBtn .default-svg,
#helpBtn .default-svg {
  display: block;
}

#streamingToggleInput .hover-svg,
#streamingGoFullscreen .hover-svg,
#streamingTerminate .hover-svg,
#addWidgetBtn .hover-svg,
#helpBtn .hover-svg {
  display: none;
}

#streamingToggleInput:hover .default-svg,
#streamingToggleInput:active .default-svg,
#streamingGoFullscreen:hover .default-svg,
#streamingGoFullscreen:active .default-svg,
#streamingTerminate:hover .default-svg,
#streamingTerminate:active .default-svg,
#addWidgetBtn:hover .default-svg,
#addWidgetBtn:active .default-svg,
#helpBtn:hover .default-svg,
#helpBtn:active .default-svg {
  display: none;
}

#streamingToggleInput:hover .hover-svg,
#streamingToggleInput:active .hover-svg,
#streamingGoFullscreen:hover .hover-svg,
#streamingGoFullscreen:active .hover-svg,
#streamingTerminate:hover .hover-svg,
#streamingTerminate:active .hover-svg,
#addWidgetBtn:hover .hover-svg,
#addWidgetBtn:active .hover-svg,
#helpBtn:hover .hover-svg,
#helpBtn:active .hover-svg {
  display: block;
}

.toggleswitch {
  --secondary-container: #1a73e8;
  --primary: #4285f4;
  position: relative;
  display: inline-block;
  width: 32px;
  height: 16px;
}

.toggleswitch input {
  display: none;
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #313033;
  transition: 0.01s;
  border-radius: 15px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  border-radius: 50%;
  left: 2px;
  bottom: 2px;
  background-color: #aeaaae;
  transition: 0.4s;
}

input:checked + .slider::before {
  background-color: white;
}

input:checked + .slider {
  background-color: var(--secondary-container);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--secondary-container);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

#appStreaming {
  position: relative;
}

#appDisconnected {
  position: relative;
}

#widgetOptionsTitle {
  font-size: 18px;
  font-weight: bold;
  color: #ffffff;
  margin-bottom: 10px;
}

#widgetOptionsSubTitle {
  font-size: 14px;
  color: #ffffff;
  margin: 10px 0;
}

.divider {
  border: none;
  height: 1px;
  background-color: #ddd;
  margin: 10px;
}

.video-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  width: 100%;
}

#widgetsContainer,
#streamFullscreenOverlay,
#streamVideoElement {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#streamFullscreenContainer:fullscreen {
  width: 100vw;
  height: 100vh;
}

#streamVideoElement {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}

.app-description {
  position: absolute;
  display: flex;
  align-items: center;
  top: 18px;
  left: 220px;
  z-index: 2;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14pt;
  font-weight: bolder;
  color: white;
  font-weight: inherit;
}

#top-banner-label {
  position: absolute;
  display: flex;
  align-items: center;
  top: 18px;
  left: 220px;
  z-index: 2;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14pt;
  font-weight: bolder;
  color: white;
  font-weight: inherit;
}

#bottom-banner-label {
  position: absolute;
  display: flex;
  align-items: center;
  top: 10px;
  left: 190px;
  z-index: 1;
}

.hidden-widgets {
  display: none;
}

.widget-menu-options {
  display: flex;
  flex-direction: column;
  width: 529px;
  padding: 10px;
  background-color: #000000;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: absolute;
  top: 60px;
  right: 0px;
  z-index: 10;
}

.widget-options {
  display: flex;
  flex-direction: column;
  width: 529px;
  padding: 10px;
  background-color: #000000;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: absolute;
  top: 125px;
  right: 0px;
  z-index: 10;
}

.widget-menu-text {
  flex-grow: 1;
  color: #ffffff;
}

#widgetOptionsContainer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

#widgetOptionsTitle {
  flex-grow: 1;
  margin-left: 10px;
  margin-top: 5px;
  padding-bottom: 5px;
}

.widget-menu-button {
  background: none;
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.3s ease;
  margin-left: auto;
  transform: translateX(350px);
}

.widget-menu-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.widget-menu-button:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.widget-menu-icon {
  fill: currentColor;
  transition: transform 0.3s ease;
  color: #ffffff;
}

.widget-menu-button[aria-expanded="true"] .widget-menu-icon {
  transform: rotate(180deg);
}

.help-menu {
  display: none;
  flex-direction: column;
  width: 529px;
  padding: 10px;
  background-color: #000000;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: absolute;
  top: 60px;
  right: 0px;
  z-index: 1001;
}

#helpTitle,
#helpSubTitle {
  color: #ffffff;
  margin-bottom: 10px;
  padding: auto;
}

#helpTitle {
  font-size: 18px;
  font-weight: bold;
}

#helpSubTitle {
  font-size: 14px;
  margin: 10px 0;
}

#helpButton .default-svg,
#helpButton .hover-svg {
  position: absolute;
  top: 0;
  left: 0;
  transition: opacity 0.3s ease;
}

#helpButton .default-svg {
  opacity: 1;
}

#helpButton .hover-svg {
  opacity: 0;
}

#helpButton.active .default-svg {
  opacity: 1;
}

#helpButton.active .hover-svg {
  opacity: 0;
}

.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 5% auto 0;
  width: 100%;
  text-align: center;
}

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

  /* Add this for horizontal centering */
  margin: 0 auto;
}

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

.loading-text {
  color: #ffffff;
  font-size: 18px;
  margin-top: 20px;
  font-family: Arial, sans-serif;
}

.webrtc-stats {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #000000b3;
  width: 95vw;
  max-width: 2000px;
  max-height: 98vh;
  overflow-y: auto;
  padding: 10px;
  border-radius: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stats-content,
.ai-stats-content {
  margin-bottom: 20px;
}

.ai-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.ai-stats {
  font-family: Arial, sans-serif;
  max-width: 800px;
  margin: 0 auto;
  background-color: #000000;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.ai-stats-content h2 {
  color: #0381ff;
  border-bottom: 2px solid #ffc400;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.ai-stats-row {
  background-color: #000000;
  border-radius: 4px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 5px rgba(37, 37, 37, 0.05);
}

.ai-stats-row h3 {
  color: #3498db;
  margin-top: 0;
  margin-bottom: 10px;
}

.ai-stats-row p {
  margin: 5px 0;
  color: #bebebe;
}

.ai-stats-row span {
  font-weight: bold;
  color: #bebebe;
}

#ai-overall-recommendation {
  font-style: italic;
  color: #27ae60;
  background-color: #000000;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

/* Responsive design */
@media (max-width: 600px) {
  .ai-stats {
    padding: 10px;
  }

  .ai-stats-row {
    padding: 10px;
  }
}

.button-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.stats-content h2 {
  text-align: center;
  margin-bottom: 20px;
  color: #3498db;
  border-radius: 4px;
}

.stat-section {
  background-color: #2c2c2c;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  box-sizing: border-box;
  overflow: auto;
}

.stat-section h3 {
  color: #3498db;
  margin-top: 0;
  margin-bottom: 10px;
  width: 85vw;
}

.stat-section p {
  margin: 5px 0;
  width: 85vw;
}

.stat-section span {
  font-weight: bold;
  color: #e0e0e0;
  width: 85vw;
}

.button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 30px;
  width: 77vw;
}

.loader-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.metric-button {
  border: 2px solid #ffffff;
  background-color: rgba(0, 0, 0, 0);
  color: #ffffff;
  transition: all 0.3s ease;
  padding: 0.25em 1em;
  font-size: 130%;
  border-radius: 15px;
  cursor: pointer;
}

.metric-button:hover,
.metric-button:active {
  background-color: #ffffff;
  color: #000000;
}

.recommendations {
  background-color: #3c3c3c;
}

@media (max-width: 768px) {
  .webrtc-stats-content {
    width: 95%;
    padding: 15px;
  }
}

#restartButton {
  margin-right: 10px;
}

.btn {
  padding: 8px 16px;
  border-radius: 4px;
}

.btn-primary {
  background-color: #007bff;
  border-color: #007bff;
  color: white;
}

.btn-primary:hover {
  background-color: #0069d9;
  border-color: #0062cc;
}

#setupUserId,
#setupEventId {
  background-color: black;
  color: white;
  border: 2px solid #ffffff;
  border-radius: 10px;
  padding: 5px;
}

#clickToReconnectButton,
#clickToReturnButton,
#clickToStartBtn,
#endSession,
#viewMetricsButton {
  margin-top: 20px;
  border: 2px solid #ffffff;
  background-color: rgba(0, 0, 0, 0);
  color: #ffffff;
  transition: all 0.3s ease;
  padding: 0.5em 2em;
  font-size: 140%;
  border-radius: 18px;
}

#clickToReconnectButton:hover,
#clickToReturnButton:hover,
#clickToStartBtn:hover,
#endSession:hover,
#viewMetricsButton:hover,
#clickToReconnectButton:active,
#clickToReturnButton:active,
#clickToStartBtn:active,
#endSession:active,
#viewMetricsButton:active {
  background-color: #ffffff;
  color: #000000;
  cursor: pointer;
}

.modal-container {
  width: 512px;
  height: 256px;
  background-color: rgba(0, 0, 0, 0.8);
  border: 2px solid #ffffff;
  border-radius: 15px;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.modal-content {
  text-align: center;
  padding: 20px;
}

.modal-title {
  color: #ffffff;
  font-size: 24px;
  margin-bottom: 15px;
  margin-top: 5px;
}

.session-stats-widget {
  display: flex;
  justify-content: center;
  gap: 30px;
  background-color: rgba(0, 0, 0, 0.6);
  padding: 10px 20px;
  border-radius: 8px;
  margin: 10px auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  height: 200px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: auto;
  padding-top: 20px;
}

.stat-label {
  color: #3498db;
  font-weight: bold;
}

.stat-value {
  color: #ffffff;
  font-family: monospace;
  font-size: small;
}

.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 77vw;
}

.stats-row {
  display: flex;
  gap: 20px;
  width: 100%;
}

.stats-row .stat-section {
  flex: 1;
  min-width: 0;
  font-size: small;
}

.stat-section::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.stat-section::-webkit-scrollbar-track {
  background: #1a1a1a;
  border-radius: 8px;
}

.stat-section::-webkit-scrollbar-thumb {
  background-color: #3a3a3a;
  border-radius: 8px;
  border: 2px solid #1a1a1a;
}

.stat-section::-webkit-scrollbar-thumb:hover {
  background-color: #4a4a4a;
}

.stat-section {
  scrollbar-width: auto;
  scrollbar-color: #3a3a3a #1a1a1a;
}

#majorMetricsChart {
  width: 100% !important;
  height: 70% !important;
}

.webrtc-analysis-container {
  padding: 20px;
  margin: 20px auto;
  max-width: 1200px;
  background-color: #1e1e1e;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  color: #ffffff;
}

.loadingIndicator {
  width: 100%;
  height: 200px;
  position: relative;
  margin-bottom: 20px;
  font-size: smaller;
}

.webrtc-analysis-widget {
  width: 100%;
  height: auto;
  position: relative;
  margin-bottom: 20px;
  font-size: smaller;
}

.webrtc-analysis-widget canvas {
  width: 100% !important;
  height: 100% !important;
}

.webrtc-analysis-widget .stat-item {
  display: inline-block;
  height: auto;
  margin-right: 20px;
}

.webrtc-analysis-widget .stat-label {
  font-weight: bold;
  color: #4a90e2;
}

.webrtc-analysis-widget .stat-value {
  color: #ffffff;
}

/* Styles for other sections in the analysis */
.webrtc-analysis-container h2 {
  color: #4a90e2;
  margin-bottom: 20px;
}

.webrtc-analysis-container .stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.webrtc-analysis-container .stat-section {
  background-color: #2a2a2a;
  padding: 15px;
  border-radius: 5px;
}

.webrtc-analysis-container .stat-section h3 {
  color: #4a90e2;
  margin-top: 0;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.full-metrics-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  overflow: hidden;
}

.panel-content {
  background-color: #1a1a1a;
  margin: 50px auto;
  padding: 20px;
  width: 90%;
  max-width: 1400px;
  height: calc(100% - 100px);
  border-radius: 10px;
  color: #d0d0d0;
  display: flex;
  flex-direction: column;
}

.panel-content h2 {
  margin-top: 0;
  color: #ffffff;
}

.csv-table-container {
  flex-grow: 1;
  overflow: auto;
  margin-bottom: 20px;
}

#csvTable {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

#csvTable th,
#csvTable td {
  border: 1px solid #444;
  padding: 8px;
  text-align: left;
}

#csvTable th {
  background-color: #2a2a2a;
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
}

#csvTable tr:nth-child(even) {
  background-color: #222;
}

.close-button {
  align-self: flex-end;
  background-color: #444;
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.close-button:hover {
  background-color: #666;
}

.stat-widget {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.stat-widget h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
  color: #ffffff;
}

.stat-widget .stat-value {
  font-size: 24px;
  font-weight: bold;
  color: #ffffff;
}

/* Mobile*/

@media (max-width: 768px) {
  .virtual-button {
    transform-origin: bottom left;
  }
}

@media (orientation: portrait) {
  #virtualControlsContainer {
    transform: rotate(90deg);
    transform-origin: bottom left;
    width: 100vh;
    height: 100vw;
    top: 100%;
    left: 0;
  }
}
.virtual-button {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
  transform-origin: center center;
}

.button-container {
  width: 100%;
  height: 100%;
}
.button-svg {
  transition: all 0.15s ease-in-out;
}

.button-svg svg {
  filter: drop-shadow(0 0 2px rgba(84, 84, 84, 0.3));
  transition: all 0.15s ease-in-out;
}

.button-svg.pressed {
  transform: scale(0.95);
  opacity: 0.5;
}

.button-svg.pressed svg {
  filter: drop-shadow(0 0 8px rgba(112, 112, 112, 0.8))
    drop-shadow(0 0 12px rgba(101, 101, 101, 0.6))
    drop-shadow(0 0 16px rgba(78, 78, 78, 0.4));
}

.button-svg:hover svg {
  filter: drop-shadow(0 0 4px rgba(110, 110, 110, 0.5));
}

/* For the joysticks */
.virtual-joystick {
  position: absolute;
  z-index: 9999;
  pointer-events: auto;
  touch-action: none;
  width: 120px;
  height: 120px;
}

.joystick-base {
  width: 100%;
  height: 100%;
  background: rgba(81, 81, 81, 0.112);
  border: 1.5px solid #ffffffd6;
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 10px rgba(33, 33, 33, 0.114);
}

.joystick-stick-wrapper {
  position: absolute;
  width: 100%;
  height: 100%;
  transition: transform 0.1s ease-out;
}

.joystick-stick {
  width: 40%;
  height: 40%;
  background: #878787bd;
  border-radius: 50%;
  position: absolute;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.114);
}

.joystick-stick.moving {
  transform: translate(
    calc(-50% + var(--move-x, 0px)),
    calc(-50% + var(--move-y, 0px))
  );
}

.controls-container {
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

#virtualControlsContainer {
  position: fixed;
  top: 100px;
  padding: 10px;
  border-radius: 4px;
  z-index: 30000;
}

#virtualStreamControlsContainer {
  display: none;
  flex-direction: row !important;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  padding: 5px;
  border-radius: 5px;
  width: auto;
  background: transparent !important;
  background-color: transparent !important;
}

#virtualStreamControlsContainer[style*="display: none"] {
  display: none !important;
  visibility: hidden !important;
}

#virtualStreamControlsContainer[style*="display: block"] {
  display: block !important;
  visibility: visible !important;
}

.virtual-button.stream-control-button {
  position: relative;
  opacity: 1;
  visibility: visible;
  margin: 10px;
  padding: 10px;
  left: auto !important;
  bottom: auto !important;
  transform: none !important;
}

#streamFullscreenContainer {
  position: fixed;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}

.streamFullscreenContainerDesktop {
  position: fixed;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}

.streamFullscreenContainerMobile {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: black;
}

.virtual-button.controls-disabled {
  pointer-events: none;
  opacity: 0.5;
}

#streamFullscreenContainer {
  pointer-events: auto;
}

#virtualStreamControlsContainer {
  pointer-events: auto;
}

video#streamVideoElement {
  pointer-events: auto;
}

@media screen and (orientation: portrait) {
  html {
    transform: rotate(-90deg);
    transform-origin: left top;
    width: 100vh;
    height: 100vw;
    overflow-x: hidden;
    position: absolute;
    top: 100%;
    left: 0;
  }
}

#touchBlockOverlay {
  pointer-events: auto !important;
}

.game-area {
  pointer-events: none;
}

/* Ensure controls are above the overlay */
#streamVideoElement {
  z-index: 1;
  position: relative;
}

#touchBlockOverlay {
  z-index: 2;
  pointer-events: auto !important;
}

#virtualControlsContainer {
  position: absolute;
  z-index: 3;
  pointer-events: auto !important;
  opacity: 0.5;
}

.virtual-button,
.virtual-joystick {
  z-index: 3;
  pointer-events: auto !important;
}

#loadingScreenCanvas {
  position: relative;
  z-index: 4;
  pointer-events: auto !important;
}

.hamburger-menu {
  position: fixed;
  top: 15px;
  right: 15px;
  width: 44px;
  height: 44px;
  background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  z-index: 999999;
  border-radius: 4px;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
  touch-action: manipulation; /* Improved touch action */
  transition: background-color 0.3s ease; /* Smooth transition for feedback */
}

.hamburger-menu:active {
  background-color: rgba(69, 160, 73, 0.8); /* Feedback color when touched */
}

/* Make the touch target area more accessible */
.hamburger-menu::before {
  content: "";
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background-color: transparent;
}

/* For non-touch devices, keep the hover effect */
@media (hover: hover) {
  .hamburger-menu:hover {
    background-color: rgba(69, 160, 73, 0.8);
  }
}

/* Add orientation-specific styles here */
.rotate-message {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #313033;
  z-index: 1000;
  transform: rotate(90deg);
  overflow: hidden;
  font-size: 16px;
}

.rotate-message h1 {
  font-size: 1.5em; /* 24px if base is 16px */
  margin-bottom: 0.5em;
}

.rotate-message p {
  font-size: 1em; /* 16px if base is 16px */
  margin-bottom: 1em;
}

.rotate-icon {
  width: 100px;
  height: 100px;
  margin: 20px auto;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M0 0h24v24H0z" fill="none"/><path d="M16.48 2.52c3.27 1.55 5.61 4.72 5.97 8.48h1.5C23.44 4.84 18.29 0 12 0l-.66.03 3.81 3.81 1.33-1.32zm-6.25-.77c-.59-.59-1.54-.59-2.12 0L1.75 8.11c-.59.59-.59 1.54 0 2.12l12.02 12.02c.59.59 1.54.59 2.12 0l6.36-6.36c.59-.59.59-1.54 0-2.12L10.23 1.75zm4.6 19.44L2.81 9.17l6.36-6.36 12.02 12.02-6.36 6.36z"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  animation: rotate 2s linear infinite;
}

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

@media screen and (orientation: portrait) {
  #portraitMessage {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
}

@media screen and (orientation: landscape) {
  #landscapeMessage {
    display: none;
  }
}

.advanced-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #313033;
  color: #ffffff;
  padding: 20px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  z-index: 1001;
  border-radius: 15px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12pt;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  width: fit-content;
}

.advanced-backdrop {
  position: fixed;
  top: 25%; /* Move down by 25% */
  left: 25%; /* Move right by 25% */
  width: 50%; /* Reduce width by 50% (25% from each side) */
  height: 50%; /* Reduce height by 50% (25% from each side) */
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
}

/* Rest of the CSS remains the same */
.advanced-overlay table {
  width: 100%;
}

.advanced-overlay table td {
  padding: 8px;
  display: block;
}

@media (min-width: 768px) {
  .advanced-overlay table td {
    display: table-cell;
  }
}

.advanced-overlay .label-cell {
  font-weight: bold;
  padding-right: 10px;
  text-align: right;
}

.advanced-overlay textarea {
  background-color: black;
  color: #ffffff;
  padding: 8px;
  border-radius: 4px;
  font-family: Arial, Helvetica, sans-serif;
  width: calc(100% - 16px);
  max-width: 100%;
  resize: vertical;
  stroke-width: 3px;
  font-size: 10pt;
  border: 2px solid #ffffff;
  border-radius: 10px;
  padding: 5px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}

.advanced-overlay button {
  margin-top: 15px;
  margin-left: 15px;
  border: 2px solid #ffffff;
  background-color: rgba(0, 0, 0, 0);
  color: #ffffff;
  transition: all 0.3s ease;
  padding: 0.25em 1em;
  font-size: 130%;
  border-radius: 15px;
  cursor: pointer;
}

.advanced-overlay button:hover {
  background-color: #ffffff;
  color: #313033;
}

.advanced-overlay h3 {
  color: #ffffff;
  margin-top: 0;
  margin-bottom: 15px;
  border-bottom: 1px solid #ffffff;
  padding-bottom: 10px;
}

@media (max-width: 480px) {
  .advanced-backdrop {
    /* Maintain the same proportions on mobile */
    top: 25%;
    left: 25%;
    width: 50%;
    height: 50%;
  }

  .advanced-overlay {
    padding: 10px;
    font-size: 11pt;
  }

  .advanced-overlay textarea {
    font-size: 10pt;
    background-color: black;
    color: white;
    border: 2px solid #ffffff;
    border-radius: 5px;
    padding: 5px;
  }

  .advanced-overlay button {
    font-size: 100%;
    padding: 0.2em 0.8em;
    margin-top: 8px;
    margin-left: 5px;
  }

  .advanced-overlay h3 {
    font-size: 1.1em;
    margin-bottom: 5px;
  }
}

#cmdLineJsonInfo,
#envVarsJsonInfo {
  font-size: 9pt;
  color: #a0a0a0; /* Light gray color for secondary information */
  font-style: italic;
  display: inline-block;
  margin-top: 2px;
}

.error-message {
  padding: 15px;
  margin: 10px 0;
  border: 1px solid #dc3545;
  border-radius: 4px;
  background-color: #f8d7da;
  color: #721c24;
}

.chart-error {
  padding: 10px;
  margin: 5px 0;
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  border-radius: 4px;
  color: #856404;
}

.metrics-container {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-height: 95vh;
}

.webrtc-stats {
  width: 100%;
}

.stats-container {
  display: flex;
  gap: 20px;
}

.stats-column {
  flex: 1;
  overflow: hidden; /* Prevent additional scrollbars */
}

/* Remove or modify the statsContent overflow */
#statsContent {
  overflow: hidden; /* This will remove the extra scrollbar */
}

.stats-content,
.ai-stats {
  width: 100%;
  max-height: 95vh;
  overflow-y: auto;
  /* Ensure only one container handles scrolling */
  overflow-x: hidden; /* Prevent horizontal scrolling if needed */
}

/* Two-column layout for larger screens when BEDROCK is true */
@media (min-width: 768px) {
  .bedrock-enabled .stats-content,
  .bedrock-enabled .ai-stats {
    width: 50%;
  }
}

.metrics-view {
  background-color: rgba(0, 0, 0, 0.9);
  padding: 20px;
  border-radius: 10px;
}

.chart-container {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
}

.metrics-actions {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.metric-button {
  padding: 10px 20px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.metric-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.session-time-display {
  text-align: center;
  color: white;
  padding: 20px;
}

.session-time-header {
  font-size: 14px;
  opacity: 0.8;
  margin-bottom: 5px;
}

.session-time-value {
  font-size: 24px;
  font-weight: bold;
}

.chart-error {
  background-color: rgba(255, 0, 0, 0.1);
  border: 1px solid rgba(255, 0, 0, 0.3);
  border-radius: 5px;
  margin: 10px 0;
  text-align: center;
  color: #ff6b6b;
  padding: 10px;
}

.no-data-message {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  padding: 20px;
  text-align: center;
  color: white;
}

#notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 10px 20px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  color: #424650;
  font-size: 14px;
  max-width: 300px;
  z-index: 10000;
  transition: opacity 0.3s ease-in-out;
}
