* {
  box-sizing: border-box;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(77, 208, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(77, 208, 255, 0);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #000;
  color: #e0e6ff;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

#root {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(10, 14, 39, 0.85) 0%, rgba(26, 31, 58, 0.85) 50%, rgba(15, 20, 40, 0.85) 100%),
              url('bg.webp') center/cover no-repeat;
  height: 100vh;
  overflow: hidden;
}

#canvasContainer {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
  height: 100%;
  border: 2px solid rgba(100, 150, 255, 0.4);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 40px rgba(100, 150, 255, 0.15),
              inset 0 0 60px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

svg {
  border: none;
}

#svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#iconLayer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

path {
  stroke: rgba(150, 180, 255, 0.5);
  stroke-width: 0.8px;
  cursor: pointer;
  transition: stroke 0.25s ease, stroke-width 0.25s ease, filter 0.25s ease;
}

path:hover {
  stroke: rgba(180, 210, 255, 0.8);
  stroke-width: 1.5px;
  filter: drop-shadow(0 0 4px rgba(150, 180, 255, 0.4));
}

text {
  font-size: 10px;
  fill: #e0e6ff;
  pointer-events: none;
  font-weight: 500;
}

.tooltip {
  position: absolute;
  background: linear-gradient(135deg, rgba(20, 35, 70, 0.98) 0%, rgba(15, 25, 55, 0.98) 100%);
  padding: 10px 16px;
  font-size: 16px;
  pointer-events: none;
  opacity: 0;
  border: 1px solid rgba(100, 150, 255, 0.5);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
              0 0 30px rgba(100, 150, 255, 0.25),
              inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(5px);
  color: #4dd0ff;
  font-weight: 500;
  z-index: 100;
  backdrop-filter: blur(12px);
  text-shadow: 0 0 10px rgba(77, 208, 255, 0.3);
}

.tooltip[style*="opacity: 1"], .tooltip:not([style*="opacity: 0"]) {
  transform: translateY(0);
}

.tooltip strong {
  color: #8dd3ff;
  text-shadow: 0 0 8px rgba(141, 211, 255, 0.4);
}

button {
  background: linear-gradient(135deg, rgba(100, 150, 255, 0.15) 0%, rgba(70, 120, 255, 0.1) 100%);
  border: 1px solid rgba(100, 150, 255, 0.4);
  color: #e0e6ff;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(4px);
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

button:hover::before {
  left: 100%;
}

button:hover {
  background: linear-gradient(135deg, rgba(100, 150, 255, 0.35) 0%, rgba(70, 120, 255, 0.25) 100%);
  border-color: rgba(150, 200, 255, 0.9);
  box-shadow: 0 4px 20px rgba(100, 150, 255, 0.4), 
              0 0 30px rgba(100, 150, 255, 0.2),
              inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  color: #fff;
  text-shadow: 0 0 10px rgba(100, 150, 255, 0.5);
}

button:active {
  transform: translateY(0px) scale(0.98);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.1s ease;
}

input[type="checkbox"] {
  vertical-align: middle;
  accent-color: #4dd0ff;
  cursor: pointer;
  width: 18px;
  height: 18px;
  border-radius: 4px;
}

label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
}

label:hover {
  background: linear-gradient(135deg, rgba(100, 150, 255, 0.15) 0%, rgba(70, 120, 255, 0.08) 100%);
  border-color: rgba(100, 150, 255, 0.2);
  transform: translateX(4px);
}

#fileButtons {
  width: 260px;
  background: linear-gradient(180deg, rgba(15, 25, 50, 0.97) 0%, rgba(20, 30, 60, 0.92) 100%);
  border: 1px solid rgba(100, 150, 255, 0.3);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
              0 0 60px rgba(100, 150, 255, 0.08),
              inset 0 1px 0 rgba(255, 255, 255, 0.05);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
  order: -1;
  animation: slideInLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  backdrop-filter: blur(10px);
}

#buttonsHeader {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.button-group-secondary {
  margin-top: 16px;
}

.button-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #8dd3ff;
  font-weight: 600;
  margin-bottom: 8px;
  text-shadow: 0 0 12px rgba(141, 211, 255, 0.4);
  opacity: 0.9;
}

.section-header {
  font-size: 14px;
  font-weight: 700;
  color: #4dd0ff;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(100, 150, 255, 0.25);
  text-shadow: 0 0 20px rgba(77, 208, 255, 0.4),
               0 0 40px rgba(77, 208, 255, 0.2);
  letter-spacing: 0.5px;
  position: relative;
}

.section-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, #4dd0ff, transparent);
  border-radius: 2px;
}

.panel-description {
  font-size: 11px;
  color: rgba(224, 230, 255, 0.7);
  margin-bottom: 14px;
  line-height: 1.5;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#planetButtons,
#regionTypeButtons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#planetButtons button,
#regionTypeButtons button {
  padding: 8px 14px;
  font-size: 12px;
  text-align: left;
}

#sidePane {
  width: 260px;
  background: linear-gradient(180deg, rgba(15, 25, 50, 0.97) 0%, rgba(20, 30, 60, 0.92) 100%);
  border: 1px solid rgba(100, 150, 255, 0.3);
  border-radius: 12px;
  padding: 20px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
              0 0 60px rgba(100, 150, 255, 0.08),
              inset 0 1px 0 rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
  order: 1;
  margin-left: auto;
  animation: slideInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  animation-delay: 0.1s;
  opacity: 0;
  animation-fill-mode: forwards;
  backdrop-filter: blur(10px);
}

.sidePane-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-section {
  border-top: 1px solid rgba(100, 150, 255, 0.2);
  padding-top: 12px;
}

.filter-section .section-header {
  margin-bottom: 8px;
  padding-bottom: 4px;
}

.filter-section .panel-description {
  margin-bottom: 8px;
}

#sidePane > div > div > label {
  display: block;
  margin-top: 0;
  margin-bottom: 8px;
  font-weight: 500;
  color: #8dd3ff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
  cursor: default;
  padding: 0;
}

#sidePane > div > div > label:hover {
  background: none;
}

#colorFilter {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#colorFilter label {
  margin: 0;
  padding: 6px;
  border-radius: 8px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(100, 150, 255, 0.15);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#colorFilter label:hover {
  background: rgba(100, 150, 255, 0.12);
  border-color: rgba(100, 150, 255, 0.35);
  transform: translateX(6px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#colorFilter label span {
  font-weight: 600;
  text-shadow: 
    0 0 8px rgba(0, 0, 0, 1.0),
    0 0 16px rgba(0, 0, 0, 0.8),
    0 1px 3px rgba(0, 0, 0, 1.0),
    0 0 2px rgba(255, 255, 255, 0.3);
  letter-spacing: 0.3px;
}

#fileButtons::-webkit-scrollbar,
#sidePane::-webkit-scrollbar {
  width: 6px;
}

#fileButtons::-webkit-scrollbar-track,
#sidePane::-webkit-scrollbar-track {
  background: rgba(100, 150, 255, 0.05);
  border-radius: 10px;
}

#fileButtons::-webkit-scrollbar-thumb,
#sidePane::-webkit-scrollbar-thumb {
  background: rgba(100, 150, 255, 0.3);
  border-radius: 10px;
}

#fileButtons::-webkit-scrollbar-thumb:hover,
#sidePane::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 150, 255, 0.5);
}

.fab {
  position: absolute;
  bottom: 20px;
  height: 44px;
  width: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  z-index: 20;
  animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  animation-delay: 0.3s;
  opacity: 0;
}

.fab--share {
  right: 20px;
}

.fab--github {
  right: 76px;
}

.fab::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(77, 208, 255, 0.4), rgba(100, 150, 255, 0.2));
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.fab:hover::after {
  opacity: 1;
  animation: pulse 1.5s ease-out infinite;
}

.fab svg {
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 0 4px rgba(100, 150, 255, 0.4));
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab:hover svg {
  filter: drop-shadow(0 0 12px rgba(100, 150, 255, 0.8));
  transform: scale(1.1);
}

@keyframes glow {
  0%, 100% {
    text-shadow: 0 0 8px rgba(255, 100, 100, 0.5),
                 0 0 16px rgba(255, 50, 50, 0.3);
  }
  50% {
    text-shadow: 0 0 16px rgba(255, 100, 100, 0.8),
                 0 0 32px rgba(255, 50, 50, 0.5),
                 0 0 48px rgba(255, 50, 50, 0.3);
  }
}

.compass text {
  animation: glow 2.5s ease-in-out infinite;
  font-weight: 700;
}

@keyframes mapFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#canvasContainer {
  animation: mapFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@media (max-width: 1024px) {
  #fileButtons {
    width: 280px;
  }
  
  #sidePane {
    width: 260px;
  }
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 30, 60, 1.0);
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-10px);
}
