body {
  margin: 0;
  overflow: hidden;
  font-family: 'Space Mono', monospace; /* Updated to Space Mono */
  background: #1a1a1a; /* Match the scene background color */
  position: relative; /* Ensure absolute positioning works correctly */
}

button {
  display: block;
  margin: 8px 0;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500; /* Slightly less bold for elegance */
  color: rgba(255, 255, 255, 0.9); /* Slightly off-white text */
  background: rgba(255, 255, 255, 0.1); /* Very subtle light background */
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0; /* Remove border radius to make it square */
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
  letter-spacing: 0.5px; /* Improved typography */
}

/* Icon button style for download button */
.icon-button {
  position: fixed;
  top: 20px;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 0;
  background: transparent;
  margin: 0;
  z-index: 220;
  transition: all 0.2s ease; /* Standard transition for all icon buttons */
  opacity: 0.5;
  pointer-events: auto;
}

/* All SVG icons inherit consistent sizing */
.icon-button svg {
  width: 24px;
  height: 24px;
  display: block; /* Ensure consistent rendering */
}

/* Consistent hover state for all buttons */
.icon-button:hover {
  opacity: 0.8;
  cursor: pointer;
}

/* Consistent active state for all buttons */
.icon-button:active {
  opacity: 0.5;
}

/* Active toggle state - used for compass heart button */
.icon-button.active {
  opacity: 0.5;
  background: transparent;
}

button:hover {
  background: rgba(255, 255, 255, 0.15); /* Slightly lighter on hover */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); /* Shadow for depth on hover */
}

button:active {
  transform: scale(0.95); /* Slight scale down on click for touch feedback */
}

button:disabled {
  background: #cccccc;
  cursor: not-allowed;
  transform: none;
}

/* Styling for the control group and color selector */
.control-group {
  margin-bottom: 15px;
}

.control-group label {
  display: block;
  margin-bottom: 5px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
  font-family: 'Space Mono', monospace; /* Updated to Space Mono */
}

select {
  width: 100%;
  padding: 8px;
  margin: 5px 0;
  border-radius: 0; /* Remove border radius to make it square */
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(26, 26, 26, 0.8);
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  transition: all 0.3s ease;
  outline: none;
  font-family: 'Space Mono', monospace; /* Updated to Space Mono */
}

select:hover {
  border: 1px solid rgba(255, 255, 255, 0.3);
}

select:focus {
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

/* Mobile-specific adjustments for controls */
@media (max-width: 768px) {
  #infoPanel {
    top: 10px;
    left: 10px;
    padding: 10px;
    font-size: 14px; /* Smaller text for mobile */
  }

  button {
    padding: 8px 16px;
    font-size: 12px; /* Smaller buttons for mobile */
  }

  .control-group label {
    font-size: 12px;
  }
  
  select {
    padding: 6px;
    font-size: 12px;
  }

  #container {
    height: 100dvh; /* Use dynamic viewport height for mobile */
  }
}

/* For mobile devices - ensure consistent sizing and positioning */
@media (max-width: 768px) {
  .icon-button {
    width: 40px;
    height: 40px;
    padding: 0; /* Remove padding to ensure exact 40x40 size */
    background: transparent !important;
    border-radius: 0 !important;
    border: none !important;
  }
  
  /* Mobile positioning from left to right: compass, download, info */
  #compassBtn {
    right: 120px; /* 60px + 40px + 20px spacing */
    top: 20px;
    z-index: 300;
  }
  
  #getObjectBtn {
    right: 70px; /* 20px + 40px + 10px spacing */
    top: 20px;
    z-index: 300;
  }
  
  #infoBtn {
    right: 20px; /* Match the close button position */
    top: 20px;
    z-index: 300;
  }
  
  /* All icons have consistent size on mobile */
  .icon-button svg {
    width: 24px; /* Keep same size on mobile for consistency */
    height: 24px;
  }
}

/* AR overlay styling (optional, for AR view feedback) */
.ar-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 0; /* Remove border radius to make it square */
  display: none; /* Hidden by default, shown in script.js if needed */
  z-index: 20;
}

.ar-loading {
  display: block;
}

#container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  touch-action: none; /* Prevent default touch actions for better interaction */
  z-index: 5; /* Ensure it's above the background but below UI elements */
}

/* Seed display in bottom left corner */
#seedDisplay {
  position: fixed;
  bottom: 10px;
  left: 10px;
  z-index: 50; /* Lower z-index to appear behind the modal */
  pointer-events: auto; /* Enable pointer events for clicking */
}

#seedInfo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.seed-line {
  font-family: 'Space Mono', monospace; /* Updated to Space Mono */
  font-size: 9px;
  color: rgba(255, 255, 255, 0.25); /* Changed from 35% to 25% opacity */
  font-weight: normal;
  line-height: 1.25; /* Changed from 1.68 to 1.25 */
  letter-spacing: 0.5px; /* Slight letter spacing for better readability */
}

.seed-value, #seedValueCorner {
  font-family: 'Space Mono', monospace; /* Updated to Space Mono */
  font-size: 9px;
  color: rgba(255, 255, 255, 0.25); /* Changed from 35% to 25% opacity */
  font-weight: normal;
  cursor: pointer; /* Show pointer cursor on hover */
  transition: color 0.2s ease;
  line-height: 1.25; /* Changed from 1.68 to 1.25 */
  letter-spacing: 0.5px; /* Slight letter spacing for better readability */
}

#seedValueCorner:hover, .seed-value:hover {
  color: rgba(255, 255, 255, 0.5); /* Increase opacity on hover */
}

#seedValueCorner:focus, .seed-value:focus {
  color: rgba(255, 255, 255, 0.5); /* Increase opacity on focus for keyboard users */
  outline: none; /* Remove default focus outline */
}

#arBtn {
  position: fixed;
  top: 20px;
  left: 70px; /* Position it to the right of the download button */
  z-index: 100;
}

/* Download button style - now positioned to the left of the info button */
#getObjectBtn {
  right: 70px; /* 20px + 40px + 10px spacing */
  top: 20px;
  /* Remove the specific transition to let it inherit the general one */
  opacity: 0.5; /* Match the base icon-button opacity */
}

.info-icon, .close-icon {
  transition: opacity 0.2s ease;
}

/* Reset the overlay to a simpler structure */
#infoOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: none; /* Hide by default */
}

/* Position the close button in the same spot as the info button */
#closeInfoBtn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1100; /* Higher than the overlay */
  background-color: transparent;
  border: none;
  opacity: 0.8;
  transition: opacity 0.2s ease;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#closeInfoBtn:hover {
  opacity: 1;
}

/* Mobile adjustments for the close button */
@media (max-width: 768px) {
  #closeInfoBtn {
    width: 40px;
    height: 40px;
    padding: 0;
  }
}

#infoContent {
  position: absolute;
  top: 20px;
  right: 20px;
  bottom: 20px;
  width: 420px;
  background-color: rgba(13, 13, 13, 0.90);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0;
  color: rgba(255, 255, 255, 0.8);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  #infoContent {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    border: none;
  }
}

/* Title container - fixed at the top */
.title-container {
  padding: 20px 20px 5px 20px;
  position: relative;
  background-color: rgba(13, 13, 13, 0.90);
  z-index: 3;
  border-bottom: none;
  margin-bottom: 0;
}

/* Ensure the title has proper styling */
.title-container h2 {
  font-size: 20px;
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.9);
  font-family: 'Space Mono', monospace;
  line-height: 1.25;
  text-transform: uppercase;
}

/* Add specific styling for the line break in the title */
.title-container h2 br {
  /* Ensure line break in title */
  display: block;
  content: "";
  margin-top: 4px;
}

/* Scrollable content area */
.scroll-container {
  flex: 1;
  overflow-y: auto;
  position: relative;
  z-index: 2;
  padding-right: 0;
  margin-right: 0;
  /* Improved scroll behavior */
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Inner content container - no mask gradient */
.scroll-content {
  padding: 6px 20px 30px 20px;
  position: relative;
}

/* Fixed gradient overlay at the bottom */
#infoContent::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 20px; /* Leave space for scrollbar */
  height: 60px; /* Height of the gradient */
  background: linear-gradient(to top, rgba(13, 13, 13, 0.95), rgba(13, 13, 13, 0));
  pointer-events: none; /* Allow clicks to pass through */
  z-index: 4; /* Above content but below title */
}

/* Custom scrollbar for WebKit browsers (Chrome, Safari, Edge) */
.scroll-container::-webkit-scrollbar {
  width: 2px; /* Ultra-thin scrollbar for maximum subtlety */
}

.scroll-container::-webkit-scrollbar-track {
  background: transparent;
  margin: 20px 0;
  border-radius: 4px;
}

.scroll-container::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  border: none;
}

.scroll-container::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  #infoContent {
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
  }
  
  .title-container {
    padding: 20px 20px 5px 20px !important;
  }
  
  .scroll-content {
    padding: 6px 20px 30px 20px !important;
  }
  
  /* Adjust fixed gradient for mobile */
  #infoContent::after {
    right: 20px;
  }
  
  #infoContent h2 {
    font-size: 18px;
    margin-top: 10px;
    margin-bottom: 20px;
  }
  
  #infoContent p {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
  }
  
  .signature {
    margin-top: 24px;
    margin-bottom: 10px; /* Consistent bottom margin on mobile */
  }
}

/* Ensure the modal content has proper spacing */
#infoContent > * {
  margin-bottom: 16px;
}

#infoContent > *:last-child {
  margin-bottom: 0;
}

#infoContent p {
  font-size: 14px; /* Copy text size: 14px */
  line-height: 1.5; /* Updated line height to 1.5 */
  margin-bottom: 16px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 300;
  font-family: 'Space Mono', monospace; /* Updated to Space Mono */
}

#infoContent p:last-of-type {
  margin-bottom: 0;
}

/* Signature styling */
.signature {
  margin-top: 24px;
  padding-top: 0; /* Removed padding since we're removing the border */
  border-top: none; /* Removed the line above the signature */
  text-align: left;
  margin-bottom: 10px; /* Added smaller bottom margin to reduce empty space below */
}

.signature a {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.2s ease;
  display: inline-block;
}

.signature a:hover {
  color: rgba(255, 255, 255, 0.9);
}

.signature-name {
  font-size: 14px; /* Signature name size: 14px */
  font-weight: 500;
  letter-spacing: 1px;
  margin-bottom: 2px;
  font-family: 'Space Mono', monospace; /* Updated to Space Mono */
  line-height: 1.5; /* Updated line height to 1.5 */
}

.signature-handle {
  font-size: 14px; /* Signature handle size: 14px */
  opacity: 0.7;
  font-family: 'Space Mono', monospace; /* Updated to Space Mono */
  line-height: 1.5; /* Updated line height to 1.5 */
}

/* Mobile adjustments for signature */
@media (max-width: 768px) {
  .signature {
    margin-top: 24px;
    margin-bottom: 10px; /* Consistent bottom margin on mobile */
  }
  
  .signature-name {
    font-size: 14px;
    line-height: 1.5;
  }
  
  .signature-handle {
    font-size: 14px;
    line-height: 1.5;
  }
}

/* Info button icon toggle */
.info-icon, .close-icon {
  transition: opacity 0.2s ease;
}

/* Mobile adjustments for info overlay */
@media (max-width: 768px) {
  #infoContent {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important; /* Force full width with !important */
    max-width: 100% !important; /* Force full width with !important */
    margin: 0 !important; /* Remove any margins */
    padding: 0 !important; /* Remove any container padding */
    border: none !important;
  }
  
  #infoContent h2 {
    font-size: 18px; /* Slightly smaller title on mobile */
    margin-bottom: 14px;
    line-height: 1.25; /* Changed from 1.5 to 1.25 to match desktop */
    text-transform: uppercase; /* Make title all caps */
  }
  
  #infoContent p {
    font-size: 14px; /* Keep the same size for copy text on mobile */
    line-height: 1.5; /* Updated line height to 1.5 */
    margin-bottom: 14px;
  }
  
  .signature-name {
    font-size: 14px; /* Keep the same size for signature name on mobile */
    line-height: 1.5; /* Updated line height to 1.5 */
  }
  
  .signature-handle {
    font-size: 14px; /* Keep the same size for signature handle on mobile */
    line-height: 1.5; /* Updated line height to 1.5 */
  }
}

/* Update the button hiding rule for when overlay is shown */
#infoOverlay:not(.hidden) ~ #getObjectBtn {
  visibility: hidden;
  opacity: 0 !important; /* Force opacity to ensure it overrides hover */
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
  z-index: 220; /* Match the icon-button z-index */
}

/* Error message styling */
.error-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 500px;
  background-color: rgba(30, 30, 30, 0.95);
  color: rgba(255, 255, 255, 0.8);
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  border-radius: 0;
  text-align: center;
  font-family: 'Space Mono', monospace;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  letter-spacing: 0.5px;
}

.error-message h3 {
  font-size: 20px;
  margin: 0 0 20px 0;
  font-weight: 400;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  line-height: 1.25;
  font-family: 'Space Mono', monospace;
}

.error-message p {
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 16px 0;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 300;
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.5px;
}

.error-message button,
.error-message .retry {
  display: inline-block;
  margin-top: 20px;
  margin-bottom: 10px;
  padding: 10px 20px;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-family: 'Space Mono', monospace;
  transition: all 0.3s ease;
  cursor: pointer;
  font-size: 14px;
  border-radius: 0;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 400;
}

.error-message button:hover,
.error-message .retry:hover {
  background-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.error-message button:active,
.error-message .retry:active {
  transform: scale(0.95);
}

/* Location and server error specific styling */
.location-error .error-message {
  border-left: none;
}

.server-error .error-message {
  border-left: none;
}

/* Mobile adjustments for error message */
@media (max-width: 768px) {
  .error-message {
    width: 90% !important;
    max-width: 100% !important;
    padding: 20px !important;
  }
  
  .error-message h3 {
    font-size: 18px;
    margin-bottom: 14px;
    line-height: 1.25;
  }
  
  .error-message p {
    font-size: 14px;
    margin-bottom: 14px;
    line-height: 1.5;
  }

  .error-message button,
  .error-message .retry {
    font-size: 12px;
    padding: 8px 16px;
  }
}

/* Loading indicator */
#loadingIndicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: rgba(255, 255, 255, 0.9);
  animation: spin 1s ease-in-out infinite;
  z-index: 100;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Heart icon states */
/* By default only show outline */
#compassBtn .heart-outline {
  display: block;
}

#compassBtn .heart-filled {
  display: none;
}

/* When active, show filled version and hide outline */
#compassBtn.active .heart-outline {
  display: none;
}

#compassBtn.active .heart-filled {
  display: block;
}

/* Position buttons from left to right in order: compass, download, info */
#compassBtn {
  right: 120px; /* 60px + 40px + 20px spacing */
  top: 20px;
}

#getObjectBtn {
  right: 70px; /* 20px + 40px + 10px spacing */
  top: 20px;
}

#infoBtn {
  right: 20px; /* Match the close button position */
  top: 20px;
}

/* Error page styling */
.error-page {
  font-family: 'Space Mono', monospace;
  background-color: #1a1a1a;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  margin: 0;
  text-align: center;
}

.error-page #errorOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.error-page #infoContent {
  position: relative;
  top: unset;
  right: unset;
  bottom: unset;
  height: auto !important;
  min-height: unset !important;
  max-height: 80vh !important;
  width: 90%;
  max-width: 500px;
  padding: 30px !important;
  overflow: visible !important;
  background-color: rgba(30, 30, 30, 0.95);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  border-radius: 0px;
  margin: 0 auto;
}

.error-page .scroll-container {
  max-height: unset !important;
  overflow-y: visible !important;
  padding-right: 0 !important;
}

.error-page .scroll-content {
  padding-bottom: 0 !important;
}

.error-page .title-container {
  margin-bottom: 20px !important;
  background: none;
}

.retry {
  display: inline-block;
  margin-top: 20px;
  margin-bottom: 10px;
  padding: 10px 20px;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  text-decoration: none;
  font-family: 'Space Mono', monospace;
  transition: all 0.3s ease;
  cursor: pointer;
  font-size: 0.9rem;
  border-radius: 4px;
}

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

/* Remove any after effects for error page */
.error-page #infoContent::after {
  display: none !important;
}

/* Remove background from error page title */
.error-page .title-container h2 {
  background-color: transparent;
  padding: 0;
}