:root {
  --bg: #060612;
  --panel: rgba(10, 10, 28, 0.88);
  --border: rgba(245, 158, 11, 0.18);
  --accent: #f59e0b;
  --accent-dim: rgba(245, 158, 11, 0.12);
  --accent-glow: rgba(245, 158, 11, 0.35);
  --fg: #f0f0f5;
  --muted: #8b8ba0;
  --danger: #ef4444;
  --success: #22c55e;
  --warn: #f59e0b;
  --font: "Space Grotesk", sans-serif;
  --radius: 10px;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: var(--font);
  color: var(--fg);
}

canvas {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Panels */
.panel {
  position: fixed;
  z-index: 10;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Header */
#header {
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  gap: 16px;
}

#header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

#header .brand i {
  color: var(--accent);
  font-size: 20px;
}

#header .brand h1 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

#header .date-display {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
}

#header .accuracy-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.acc-high {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.acc-mod {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warn);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.acc-low {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Planet sidebar */
#planet-list {
  top: 80px;
  left: 16px;
  width: 180px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.planet-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.15s;
  border: 1px solid transparent;
}

.planet-item:hover {
  background: var(--accent-dim);
  transform: translateX(2px);
}

.planet-item.active {
  background: var(--accent-dim);
  border-color: var(--border);
}

.planet-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.planet-item .pname {
  font-size: 13px;
  font-weight: 500;
  flex: 1;
}

.planet-item .pdist {
  font-size: 10px;
  color: var(--muted);
  font-weight: 300;
}

/* Info panel */
#info-panel {
  top: 80px;
  right: 16px;
  width: 240px;
  padding: 20px;
  display: none;
}

#info-panel.visible {
  display: block;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

#info-panel .info-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

#info-panel .info-header .idot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

#info-panel .info-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.info-section {
  margin-bottom: 14px;
}

.info-section h3 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-bottom: 8px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 12px;
}

.info-row .label {
  color: var(--muted);
}

.info-row .value {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

#info-panel .close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  transition: color 0.2s;
}

#info-panel .close-btn:hover {
  color: var(--fg);
}

/* Controls bar */
#controls {
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.ctrl-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--accent-dim);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.2s;
}

.ctrl-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}

.ctrl-btn.active {
  background: var(--accent);
  color: var(--bg);
}

.speed-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.speed-group label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.speed-group .speed-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  min-width: 80px;
  text-align: center;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 120px;
  height: 4px;
  background: rgba(245, 158, 11, 0.2);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-glow);
}

.predict-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.predict-group label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

input[type="date"] {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 6px 10px;
  border-radius: 6px;
  font-family: var(--font);
  font-size: 12px;
  outline: none;
}

input[type="date"]:focus {
  border-color: var(--accent);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7) sepia(1) hue-rotate(0deg);
  cursor: pointer;
}

.go-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}

.go-btn:hover {
  background: var(--accent);
  color: var(--bg);
}

.divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

/* View presets */
.view-btns {
  display: flex;
  gap: 4px;
}

.view-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 11px;
  transition: all 0.2s;
}

.view-btn:hover,
.view-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

/* Labels */
.planet-label {
  position: fixed;
  z-index: 5;
  pointer-events: none;
  font-size: 10px;
  font-weight: 500;
  color: rgba(240, 240, 245, 0.7);
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  transform: translate(-50%, -100%);
  padding-bottom: 4px;
  transition: opacity 0.3s;
}

/* Disclaimer */
#disclaimer-btn {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 10;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-family: var(--font);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
}

#disclaimer-btn:hover {
  color: var(--fg);
}

#disclaimer-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
}

#disclaimer-modal.visible {
  display: flex;
}

#disclaimer-modal .modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 480px;
  width: 90%;
  backdrop-filter: blur(20px);
}

#disclaimer-modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--accent);
}

#disclaimer-modal p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 10px;
}

#disclaimer-modal .close-modal {
  margin-top: 16px;
  padding: 8px 20px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
}

/* Toast */
#toast-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.toast {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  animation:
    toastIn 0.3s ease,
    toastOut 0.3s ease 2.7s forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* Responsive */
@media (max-width: 768px) {
  #planet-list {
    display: none;
  }

  #info-panel {
    width: 200px;
    padding: 14px;
  }

  #controls {
    padding: 10px 14px;
    gap: 8px;
  }

  input[type="range"] {
    width: 80px;
  }

  .predict-group label {
    display: none;
  }

  .divider {
    display: none;
  }
}

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