* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: #08080f;
  color: #e0e0e0;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  width: 100vw;
  height: 100dvh;
  position: fixed;
}

canvas#universe {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

/* --- Title Overlay --- */
#title-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
  transition: opacity 1.5s ease;
}
#title-overlay.fade-out {
  opacity: 0;
}
#title-overlay h1 {
  font-size: 28px;
  font-weight: 300;
  letter-spacing: 8px;
  color: #ffffff;
  text-shadow: 0 0 30px rgba(150, 180, 255, 0.5);
}
#title-overlay p {
  margin-top: 16px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 2px;
}

/* --- Input Bar --- */
#input-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 20;
  background: linear-gradient(transparent, rgba(8, 8, 15, 0.9) 30%);
}
#word-form {
  display: flex;
  gap: 8px;
  max-width: 500px;
  margin: 0 auto;
}
#word-input {
  flex: 1;
  padding: 12px 16px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 0;
  color: #ffffff;
  outline: none;
  transition: border-color 0.2s;
}
#word-input:focus {
  border-color: rgba(150, 180, 255, 0.6);
}
#word-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}
#submit-btn {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 0;
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
#submit-btn:active {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(0.95);
}

/* --- UI Buttons --- */
.ui-btn {
  position: absolute;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 16px;
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ui-btn:active {
  background: rgba(255, 255, 255, 0.12);
}
#time-toggle {
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
}
#info-btn {
  top: max(12px, env(safe-area-inset-top));
  right: 60px;
}

/* --- Time Scrub --- */
#time-scrub-container {
  position: absolute;
  top: max(60px, calc(env(safe-area-inset-top) + 48px));
  left: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(8, 8, 15, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: opacity 0.3s;
}
#time-scrub {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
}
#time-scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border: none;
  cursor: pointer;
}
#time-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  min-width: 60px;
  text-align: right;
}

/* --- Info Panel --- */
#info-panel {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(8, 8, 15, 0.92);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
}
.info-content {
  text-align: center;
  padding: 32px;
}
.info-content h2 {
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 4px;
  margin-bottom: 24px;
}
.info-content p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 8px;
}
.close-btn {
  margin-top: 24px;
  padding: 8px 24px;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
}

/* --- Constellation Modal --- */
#constellation-modal {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(8, 8, 15, 0.92);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-content {
  text-align: center;
  padding: 32px;
  max-width: 340px;
  width: 100%;
}
.modal-content h2 {
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 3px;
  margin-bottom: 16px;
  color: rgba(180, 200, 255, 0.9);
}
#constellation-suggestion {
  font-size: 22px;
  color: #ffffff;
  margin-bottom: 24px;
  letter-spacing: 2px;
}
#constellation-name-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 0;
  color: #ffffff;
  outline: none;
  margin-bottom: 16px;
  text-align: center;
}
.modal-buttons {
  display: flex;
  gap: 8px;
}
.modal-buttons button {
  flex: 1;
  padding: 12px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  cursor: pointer;
  transition: background 0.2s;
}
.modal-buttons button:active {
  background: rgba(255, 255, 255, 0.15);
}

/* --- Star Label --- */
#star-label {
  position: absolute;
  pointer-events: none;
  z-index: 15;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 0 8px rgba(100, 150, 255, 0.5);
  letter-spacing: 1px;
  white-space: nowrap;
  transition: opacity 0.3s;
}

/* --- Utility --- */
.hidden {
  display: none !important;
}
