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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100lvh;
  min-height: -webkit-fill-available;
  color: #fff;
}

/* Navigation Header */
.nav-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-header h1 {
  font-size: 1.2rem;
  font-weight: 600;
}

.nav-links {
  display: flex;
  gap: 1rem;
}

.nav-links a {
  color: #fff;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(255, 255, 255, 0.2);
}

/* Index Page */
.index-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100lvh;
  min-height: -webkit-fill-available;
  padding: 2rem;
  text-align: center;
}

.index-container h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.index-container p {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 3rem;
}

.viewer-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  max-width: 800px;
  width: 100%;
}

.viewer-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 2rem;
  text-decoration: none;
  color: #fff;
  transition: transform 0.3s, box-shadow 0.3s;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.viewer-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.3);
}

.viewer-card h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.viewer-card p {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 0;
}

.viewer-card .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Viewer Container */
.viewer-container {
  position: fixed;
  inset: 0;
}

/* Model Viewer Specific */
model-viewer {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #e0e0e0 0%, #a0a0a0 100%);
}

model-viewer::part(default-progress-bar) {
  background-color: #fff;
}

model-viewer::part(default-ar-button) {
  top: 100px;
  right: 1rem;
  bottom: auto;
  left: auto;
}

/* Three.js Canvas */
#ocean-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-overlay.hidden {
  display: none;
}

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

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

.loading-text {
  margin-top: 1rem;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Controls Panel */
.controls-panel {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  padding: 1rem 2rem;
  border-radius: 12px;
  display: flex;
  gap: 1.5rem;
  align-items: center;
  z-index: 100;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.control-group label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
}

.control-group input[type="range"] {
  width: 120px;
}

/* Camera Controls Help */
.controls-help {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  z-index: 100;
  line-height: 1.6;
}

.controls-help div {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.controls-help kbd {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.7rem;
}

/* AR Button */
.ar-button-custom {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: background 0.2s, border-color 0.2s;
}

.ar-button-custom:hover {
  background: rgba(0, 0, 0, 0.85);
  border-color: rgba(255, 255, 255, 0.4);
}

.ar-button-custom::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'%3E%3Cpath d='M12 2L2 7v10l10 5 10-5V7L12 2zm0 2.18l6.9 3.45L12 11.09 5.1 7.63 12 4.18zM4 8.82l7 3.5v7.27l-7-3.5V8.82zm9 10.77v-7.27l7-3.5v7.27l-7 3.5z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

/* ===================
   Mobile Responsive
   =================== */
@media (max-width: 768px) {
  /* Navigation Header */
  .nav-header {
    padding: 0.75rem 1rem;
    flex-direction: column;
    gap: 0.5rem;
  }

  .nav-header h1 {
    font-size: 1rem;
  }

  .nav-links {
    gap: 0.5rem;
  }

  .nav-links a {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }


  /* Controls Panel */
  .controls-panel {
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    transform: none;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .control-group {
    flex: 0 0 auto;
    min-width: 80px;
  }

  .control-group input[type="range"] {
    width: 80px;
  }

  .control-group input[type="color"] {
    width: 40px;
    height: 28px;
  }

  /* Controls Help - hide on mobile to reduce clutter */
  .controls-help {
    display: none;
  }

  /* AR Button - position above controls panel */
  .ar-button-custom {
    bottom: auto;
    top: 100px;
    right: 1rem;
    left: auto;
    transform: none;
  }

  /* Index Page */
  .index-container h1 {
    font-size: 2rem;
  }

  .index-container p {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .viewer-cards {
    gap: 1rem;
    padding: 0 1rem;
  }

  .viewer-card {
    padding: 1.5rem;
  }

  .viewer-card .icon {
    font-size: 2rem;
  }

  .viewer-card h2 {
    font-size: 1.2rem;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .nav-header h1 {
    font-size: 0.9rem;
  }

  .nav-links a {
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
  }

  .controls-panel {
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
  }

  .control-group {
    min-width: 70px;
  }

  .control-group label {
    font-size: 0.65rem;
  }

  .control-group input[type="range"] {
    width: 70px;
  }

  .index-container h1 {
    font-size: 1.5rem;
  }
}
