/* ═══════════════════════════════════════
   UKŁAD SŁONECZNY — Styles
   ═══════════════════════════════════════ */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #05051a;
  font-family: 'Nunito', 'Plus Jakarta Sans', sans-serif;
  color: #e8e8f0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: fixed;
  inset: 0;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
canvas:active { cursor: grabbing; }

/* ─── Back Nav ─── */
.back-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding: 0.5rem 1rem;
  background: rgba(5,5,26,0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #818cf8;
  text-decoration: none;
  transition: opacity 150ms;
}
.back-link:hover { opacity: 0.7; }

/* ─── HUD ─── */
.hud {
  position: fixed;
  top: 44px;
  left: 0;
  right: 0;
  z-index: 50;
  text-align: center;
  padding: 0.75rem 1rem 0.5rem;
  pointer-events: none;
}

.hud-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(1.1rem, 0.9rem + 1vw, 1.6rem);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.hud-hint {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
  margin-top: 0.2rem;
  transition: opacity 300ms;
}

/* ─── Zoom Controls ─── */
.zoom-controls {
  position: fixed;
  bottom: 5rem;
  right: 1rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.zoom-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.zoom-btn:hover {
  background: rgba(255,255,255,0.18);
  transform: scale(1.08);
}
.zoom-btn:active { transform: scale(0.95); }

/* ─── Speed Control ─── */
.speed-control {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
}

.speed-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
}

.speed-slider {
  width: 100px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  outline: none;
}
.speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #818cf8;
  cursor: pointer;
  border: 2px solid #fff;
}
.speed-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #818cf8;
  cursor: pointer;
  border: 2px solid #fff;
}

.speed-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

/* ─── Info Popup ─── */
.info-popup {
  position: fixed;
  z-index: 100;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 90%;
  max-width: 380px;
  max-height: 80vh;
  overflow-y: auto;
  background: rgba(15,15,40,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(99,102,241,0.15);
  opacity: 0;
  pointer-events: none;
  transition: all 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.info-popup.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.popup-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms;
}
.popup-close:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.popup-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.popup-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.popup-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

.popup-type {
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.popup-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stat-item {
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
}

.stat-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  margin-top: 0.1rem;
}

.popup-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.7);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.popup-fun {
  background: rgba(129,140,248,0.1);
  border: 1px solid rgba(129,140,248,0.2);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #a5b4fc;
}

.popup-fun::before {
  content: '💡 ';
}

/* ─── Footer ─── */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 10;
  padding: 0.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.footer-home {
  font-weight: 700;
  color: #818cf8;
  font-size: 0.7rem;
  text-decoration: none;
}

.site-footer a:last-child {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.2);
  text-decoration: none;
}

/* ─── Mobile ─── */
@media (max-width: 500px) {
  .info-popup {
    max-width: calc(100% - 2rem);
    padding: 1.25rem;
  }

  .popup-stats {
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }

  .speed-control {
    bottom: 0.75rem;
    padding: 0.4rem 0.75rem;
  }

  .speed-label { display: none; }
  .speed-slider { width: 80px; }

  .zoom-controls {
    bottom: 4rem;
    right: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
