/* ==========================================================================
   Гриша Лук 🌍 — Home Page Styles (Dark Cosmic Theme)
   ========================================================================== */

:root {
  --bg-color: #030712;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-cyan: #38bdf8;
  --accent-blue: #2563eb;
  --accent-glow: rgba(56, 189, 248, 0.35);
  --glass-bg: rgba(15, 23, 42, 0.72);
  --glass-border: rgba(255, 255, 255, 0.12);
  --toast-bg: rgba(15, 23, 42, 0.88);
  --toast-border: rgba(56, 189, 248, 0.35);
}

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

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-color);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-main);
  user-select: none;
  -webkit-user-select: none;
}

/* Background space radial lighting */
body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 45%, #0d1a33 0%, #060c18 55%, #02050b 100%);
  pointer-events: none;
  z-index: 0;
}

.space-app {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
}

/* Header */
.app-header {
  position: absolute;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 10;
  pointer-events: none;
  width: 90%;
  max-width: 600px;
}

.app-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #ffffff 30%, #93c5fd 80%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 35px var(--accent-glow);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.globe-icon {
  -webkit-text-fill-color: initial;
  display: inline-block;
  transform-origin: center;
  animation: pulse-spin 12s ease-in-out infinite;
}

@keyframes pulse-spin {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.08) rotate(10deg); }
}

.app-subtitle {
  margin-top: 0.25rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.85;
}

/* Canvas Container */
.canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

#globe-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  outline: none;
}

#globe-canvas:active {
  cursor: grabbing;
}

/* Footer & Hint */
.app-footer {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
  width: 90%;
  max-width: 520px;
  display: flex;
  justify-content: center;
}

.globe-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0.7rem 1.4rem;
  border-radius: 9999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(56, 189, 248, 0.15);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-main);
  animation: float-subtle 4s ease-in-out infinite;
  text-align: center;
}

.hint-icon {
  font-size: 1.1rem;
}

@keyframes float-subtle {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-4px); }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px) scale(0.95);
  background: var(--toast-bg);
  border: 1px solid var(--toast-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #ffffff;
  padding: 0.8rem 1.6rem;
  border-radius: 9999px;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(56, 189, 248, 0.35);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.18, 0.89, 0.32, 1.28), visibility 0.28s;
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
}

.toast.water {
  border-color: rgba(251, 191, 36, 0.6);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(251, 191, 36, 0.3);
}

.toast.success {
  border-color: rgba(52, 211, 153, 0.6);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(52, 211, 153, 0.35);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loading-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.spinner-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.planet-spinner {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 3px solid rgba(56, 189, 248, 0.15);
  border-top-color: var(--accent-cyan);
  border-right-color: #60a5fa;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 20px var(--accent-glow);
}

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

.loading-text {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  animation: pulse-text 1.5s ease-in-out infinite alternate;
}

@keyframes pulse-text {
  from { opacity: 0.5; }
  to { opacity: 1; }
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .app-header {
    top: 1rem;
  }

  .app-title {
    font-size: 1.75rem;
  }

  .app-subtitle {
    font-size: 0.8rem;
  }

  .app-footer {
    bottom: 1.4rem;
  }

  .globe-hint {
    padding: 0.6rem 1rem;
    font-size: 0.82rem;
  }

  .toast {
    bottom: 4.8rem;
    font-size: 0.9rem;
    padding: 0.7rem 1.2rem;
  }
}
