/* Constellation Draw – Deep Telescope Night Sky & Starfield Canvas */
:root {
  --bg-space: #000000;
  --panel-bg: rgba(10, 12, 20, 0.85);
  --panel-border: rgba(255, 255, 255, 0.15);
  --text-main: #ffffff;
  --text-muted: #94a3b8;
  --accent-cyan: #38bdf8;
  --accent-gold: #facc15;
  --accent-purple: #ceabff;
  --active-color: #a4cbff;
}

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

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-space);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Outfit", "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

.app-wrapper {
  width: 100%;
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Starfield Viewport & Canvas */
.canvas-viewport {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  cursor: crosshair;
  background: radial-gradient(circle at center, #070a14 0%, #000000 90%);
}

#star-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Top Floating Header & Nav */
.top-header {
  position: fixed;
  top: 16px;
  left: 20px;
  right: 20px;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.top-left-group, .top-right-group {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 50px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
  cursor: pointer;
}

.nav-pill:hover {
  background: rgba(25, 30, 48, 0.95);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.nav-pill.active {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #ffffff 40%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Floating Bottom Toolbar */
.bottom-toolbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  padding: 8px 16px;
  border-radius: 50px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.tool-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 50px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tool-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.tool-btn.active {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.15);
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--panel-border);
  margin: 0 4px;
}

/* Color Palette Swatches */
.palette-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.color-swatch:hover {
  transform: scale(1.2);
}

.color-swatch.selected {
  border-color: #ffffff;
  transform: scale(1.25);
  box-shadow: 0 0 10px currentColor;
}

/* Star Info Tooltip (Bottom Left) */
.star-info-hud {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 45;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px 18px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 280px;
}

.star-info-hud.hidden {
  opacity: 0;
  transform: translateY(10px);
}

.star-name {
  font-size: 1rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 2px;
}

.star-coords {
  font-family: "Space Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}

.star-details {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Zoom Controls (Bottom Right) */
.zoom-controls {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.zoom-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.zoom-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Modals (Confirm, Share, Name Input) */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: #0d1117;
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 28px;
  width: 90%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.modal-backdrop.active .modal-card {
  transform: scale(1);
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: #ffffff;
}

.modal-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.modal-input {
  width: 100%;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 12px 16px;
  color: #ffffff;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  outline: none;
  text-align: center;
}

.modal-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-primary {
  background: var(--accent-cyan);
  color: #000000;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 12px 24px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: #7dd3fc;
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 50px;
  border: 1px solid var(--panel-border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Share Modal Preview Canvas */
.preview-canvas-container {
  width: 100%;
  height: 200px;
  background: #000000;
  border-radius: 12px;
  border: 1px solid #30363d;
  margin-bottom: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#preview-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Bottom Container for SEO Article & Discovery Footer */
.bottom-info-deck {
  position: relative;
  z-index: 20;
  margin-top: 100vh;
  width: 100%;
  background: #050508;
  border-top: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.seo-article {
  width: 95%;
  max-width: 960px;
  margin: 20px auto 25px auto;
  padding: 24px 28px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.seo-article h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.seo-article h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 14px 0 6px 0;
}

/* Responsive Mobile Layout */
@media (max-width: 768px) {
  .bottom-toolbar {
    width: 94%;
    justify-content: space-between;
    padding: 6px 12px;
    border-radius: 20px;
    overflow-x: auto;
  }
  .palette-group {
    display: none;
  }
  .star-info-hud {
    left: 12px;
    bottom: 80px;
    font-size: 0.75rem;
    padding: 8px 12px;
  }
  .zoom-controls {
    right: 12px;
    bottom: 80px;
  }
}
