:root {
  --primary-color: #0078ff;
  --secondary-color: #00a8ff;
  --accent-color: #ff6600;
  --warning-color: #ff3333;
  --background-dark: #000000;
  --background-medium: #111827;
  --background-light: #1f2937;
  --text-light: #ffffff;
  --text-dim: #a0aec0;
  --shadow-color: rgba(0, 0, 0, 0.5);
  --font-main: 'Segoe UI', 'Roboto', sans-serif;
  --font-display: 'Orbitron', 'Arial', sans-serif;
}

@font-face {
  font-family: 'Orbitron';
  src: url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700&display=swap');
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-main);
  background-color: var(--background-dark);
  color: var(--text-light);
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
}

/* Loading Screen */
#loading-screen {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: var(--background-dark);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.loading-content {
  text-align: center;
  max-width: 600px;
  padding: 40px;
  position: relative;
  z-index: 5;
}

/* Loading background starfield and lit sphere behind text */
#loading-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.03) 0%, rgba(0,0,0,0) 30%),
    radial-gradient(ellipse at 80% 70%, rgba(255,255,255,0.02) 0%, rgba(0,0,0,0) 30%),
    radial-gradient(ellipse at 50% 10%, rgba(255,255,255,0.02) 0%, rgba(0,0,0,0) 25%),
    radial-gradient(closest-side, rgba(255,255,255,0.9) 1px, rgba(255,255,255,0) 2px);
  background-size: cover;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: normal;
  opacity: 1;
}

/* simulated star pattern using layered tiny radial gradients */
#loading-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(rgba(255,255,255,0.9) 0.6px, rgba(255,255,255,0) 0.7px) 0 0 / 3px 3px,
    radial-gradient(rgba(255,255,255,0.6) 0.5px, rgba(255,255,255,0) 0.6px) 1.5px 1.5px / 6px 6px,
    linear-gradient(180deg, rgba(0,0,8,0.65), rgba(0,0,0,0.9));
  opacity: 0.9;
  z-index: 2;
  pointer-events: none;
}

/* Big sphere behind the loading text to suggest the globe */
.loading-sphere {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  right: 10%;
  top: 10%;
  background-image: url('/earthsurvay.jpg');
  background-size: cover;
  background-position: center;
  /* Boost perceived brightness and add multi-directional highlights */
  filter: brightness(1.18) contrast(1.06) saturate(1.02);
  z-index: 3;
  pointer-events: none;
  box-shadow:
    inset 120px 40px 180px rgba(255,255,240,0.25),
    inset -60px -20px 120px rgba(120,170,255,0.18),
    0 30px 120px rgba(0,0,0,0.55);
  background-blend-mode: overlay;
  opacity: 1;
  /* gentle outer glow to make the sphere read clearly against the starfield */
  outline: 8px solid rgba(0, 120, 255, 0.03);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 85%, transparent 100%);
}

/* Slight vignette to help text pop */
#loading-screen .loading-content::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 12px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 40%, rgba(0,0,0,0.6) 100%);
  z-index: 4;
  pointer-events: none;
}

/* Make the '220' light blue */
.loading-content h1 .light220 {
  color: var(--secondary-color);
  text-shadow: 0 0 18px rgba(0,168,255,0.9);
}

.loading-content h1 {
  font-family: var(--font-display);
  font-size: 4rem;
  letter-spacing: 4px;
  margin-bottom: 24px;
  color: var(--text-light);
  text-shadow: 0 0 10px var(--primary-color);
}

.loading-content h1 span {
  color: var(--primary-color);
}

.loading-bar-container {
  width: 100%;
  height: 6px;
  background-color: var(--background-light);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}

.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.loading-status {
  font-size: 1rem;
  color: var(--text-dim);
  letter-spacing: 1px;
}

/* Main Simulation */
#elevator-simulation {
  position: absolute;
  width: 100%;
  height: 100%;
}

#canvas-container {
  position: absolute;
  width: 100%;
  height: 100%;
}

/* UI Overlay */
.mobile-only {
  display: none;
}

#ui-overlay {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
}

#header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  border-radius: 10px;
  pointer-events: auto;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: bold;
  letter-spacing: 2px;
}

.logo span {
  color: var(--primary-color);
}

#status-display {
  display: flex;
  gap: 20px;
}

.status-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.status-item .label {
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.status-item .value {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-light);
}

#mission-control {
  align-self: center;
  margin-bottom: 40px;
  display: flex;
  gap: 15px;
  pointer-events: auto;
}

/* Buttons */
.primary-btn, .secondary-btn, .warning-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 5px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
  transform: translateY(0);
}

.primary-btn {
  background-color: var(--primary-color);
  color: var(--text-light);
  box-shadow: 0 0 15px rgba(0, 120, 255, 0.5);
}

.primary-btn:hover {
  background-color: var(--secondary-color);
  box-shadow: 0 0 20px rgba(0, 168, 255, 0.7);
  transform: translateY(-2px);
}

.secondary-btn {
  background-color: var(--background-light);
  color: var(--text-light);
  border: 1px solid var(--primary-color);
}

.secondary-btn:hover {
  background-color: rgba(0, 120, 255, 0.1);
  transform: translateY(-2px);
}

.small-btn {
  padding: 8px 16px;
  font-size: 0.8rem;
}

/* Iframe Modal */
#iframe-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--background-dark);
  z-index: 2000;
  display: flex;
  flex-direction: column;
}

#close-iframe-modal {
  position: absolute;
  top: 15px;
  right: 20px;
  z-index: 2001;
  background-color: rgba(0,0,0,0.5);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

#content-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.warning-btn {
  background-color: var(--background-light);
  color: var(--warning-color);
  border: 1px solid var(--warning-color);
}

.warning-btn:hover {
  background-color: rgba(255, 51, 51, 0.1);
  transform: translateY(-2px);
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 5px;
}

.icon-btn:hover {
  color: var(--primary-color);
}

/* Notification Center (Sci-Fi Terminal) */
#notification-center {
  position: absolute;
  bottom: 100px;
  right: 20px;
  width: 350px;
  background-color: rgba(5, 15, 25, 0.85);
  backdrop-filter: blur(8px);
  border-radius: 4px;
  border: 1px solid #00ffcc;
  box-shadow: 0 0 20px rgba(0, 255, 204, 0.2), inset 0 0 15px rgba(0, 255, 204, 0.1);
  padding: 15px;
  pointer-events: auto;
  font-family: 'Courier New', Courier, monospace;
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(0, 255, 204, 0.4);
  padding-bottom: 5px;
}

.notification-header h3 {
  font-size: 0.9rem;
  color: #00ffcc;
  letter-spacing: 2px;
  text-shadow: 0 0 8px #00ffcc;
  font-family: var(--font-display);
}

#notifications-list {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notification {
  padding: 8px;
  background: rgba(0, 255, 204, 0.05);
  border-left: 2px solid #00ffcc;
  font-size: 0.85rem;
  line-height: 1.4;
}

.notification .time {
  font-size: 0.7rem;
  color: #00a8ff;
  margin-bottom: 4px;
  font-weight: bold;
}

.notification .message {
  color: #e0f8ff;
  text-shadow: 0 0 2px rgba(224, 248, 255, 0.5);
}

.typewriter-cursor {
  display: inline-block;
  width: 8px;
  height: 12px;
  background-color: #00ffcc;
  margin-left: 2px;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Station Interface */
#station-interface {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: var(--background-dark);
}

#station-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background-color: var(--background-medium);
  border-bottom: 1px solid var(--background-light);
}

#station-view {
  display: flex;
  height: calc(100% - 60px);
}

#station-canvas-container {
  flex: 1;
  position: relative;
}

#station-ui {
  width: 300px;
  background-color: var(--background-medium);
  padding: 20px;
  border-left: 1px solid var(--background-light);
  display: flex;
  flex-direction: column;
  gap: 30px;
}

#location-info h3 {
  color: var(--primary-color);
  margin-bottom: 10px;
  font-family: var(--font-display);
  letter-spacing: 1px;
}

#location-description {
  color: var(--text-dim);
  line-height: 1.5;
  font-size: 0.9rem;
}

#navigation-controls h3 {
  color: var(--text-light);
  margin-bottom: 15px;
  font-family: var(--font-display);
  letter-spacing: 1px;
  font-size: 0.9rem;
}

#navigation-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-btn {
  padding: 10px 15px;
  background-color: var(--background-light);
  color: var(--text-light);
  border: none;
  border-radius: 5px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.nav-btn:hover, .nav-btn.active {
  background-color: var(--primary-color);
}

/* User Dashboard */
#user-dashboard {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 800px;
  height: 80%;
  max-height: 600px;
  background-color: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 10px;
  border: 1px solid var(--primary-color);
  box-shadow: 0 0 30px rgba(0, 120, 255, 0.3);
  padding: 25px;
  z-index: 1000;
}

#user-dashboard h2 {
  font-family: var(--font-display);
  letter-spacing: 2px;
  color: var(--primary-color);
  margin-bottom: 20px;
  text-align: center;
}

#close-dashboard {
  position: absolute;
  top: 15px;
  right: 15px;
}

.dashboard-tabs {
  display: flex;
  border-bottom: 1px solid var(--background-light);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
}

.tab-content {
  height: calc(100% - 100px);
  overflow-y: auto;
}

.tab-content h3 {
  font-size: 1.1rem;
  margin-bottom: 15px;
  color: var(--text-light);
}

#journey-log {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.journey-card {
  background-color: var(--background-light);
  border-radius: 5px;
  padding: 15px;
}

.journey-card .journey-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.journey-card .journey-title {
  font-weight: 500;
}

.journey-card .journey-date {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.journey-card .journey-stats {
  display: flex;
  gap: 15px;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.status-card {
  background-color: var(--background-light);
  border-radius: 5px;
  padding: 15px;
}

.status-card h4 {
  font-size: 0.9rem;
  margin-bottom: 10px;
  color: var(--text-light);
}

.progress-bar {
  height: 8px;
  background-color: var(--background-medium);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 5px;
}

.progress {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.status-card p {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.status-card .large-stat {
  font-size: 2rem;
  color: var(--primary-color);
  margin: 10px 0;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.achievement-card {
  background-color: var(--background-light);
  border-radius: 5px;
  padding: 15px;
  text-align: center;
}

.achievement-icon {
  font-size: 2rem;
  margin-bottom: 10px;
  color: var(--primary-color);
}

.achievement-card h4 {
  font-size: 0.9rem;
  margin-bottom: 5px;
}

.achievement-card p {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.empty-state {
  color: var(--text-dim);
  text-align: center;
  padding: 30px;
  font-style: italic;
}

.hidden {
  display: none !important;
}

/* POV Controls */
#pov-controls {
  position: absolute;
  bottom: 50%;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}

.pov-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  border: 1px solid var(--primary-color);
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pov-btn:hover {
  background-color: var(--primary-color);
  transform: scale(1.1);
}

.pov-btn.active {
  background-color: var(--primary-color);
}

/* Multiplayer UI Styles */
#other-users-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  border-radius: 10px;
  padding: 10px;
  pointer-events: auto;
}

#other-users-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

#other-users-title h3 {
  font-size: 0.8rem;
  color: var(--primary-color);
  margin: 0;
}

#user-count {
  background-color: var(--primary-color);
  color: var(--text-light);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

#other-users-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 150px;
}

.user-avatar {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--background-medium);
  color: var(--text-light);
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  z-index: 10;
}

.location-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--background-dark);
}

.elevator-location {
  background-color: var(--primary-color);
}

.station-location {
  background-color: var(--accent-color);
}

@media (max-width: 768px) {
  .mobile-only {
    display: flex !important;
  }
  
  #header {
    display: none;
  }
  
  #mobile-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    border-radius: 10px;
    pointer-events: auto;
  }
  
  #mission-control {
    display: none;
  }
  
  #mobile-bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(10, 20, 30, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--primary-color);
    padding: 10px 0;
    z-index: 100;
    pointer-events: auto;
    padding-bottom: env(safe-area-inset-bottom, 15px);
  }
  
  .nav-btn-mobile {
    background: none;
    border: none;
    color: var(--text-dim);
    font-family: var(--font-display);
    font-size: 0.7rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px;
    cursor: pointer;
  }
  
  .nav-btn-mobile.primary {
    color: var(--primary-color);
    font-weight: bold;
    transform: translateY(-5px);
  }
  
  .nav-btn-mobile.warning {
    color: var(--warning-color);
  }
  
  .nav-btn-mobile.active {
    color: var(--primary-color);
  }
  
  .nav-btn-mobile .icon {
    font-size: 1.5rem;
  }
  
  #notification-center {
    bottom: 90px;
    right: 10px;
    left: 10px;
    width: auto;
  }
  
  #pov-controls {
    bottom: 100px;
    right: 15px;
  }
  
  .status-grid, .achievements-grid {
    grid-template-columns: 1fr;
  }
  
  #station-view {
    flex-direction: column;
  }
  
  #station-ui {
    width: 100%;
    height: 40%;
    overflow-y: auto;
    border-left: none;
    border-top: 1px solid var(--background-light);
  }
}