:root {
  --col-void: #040810;
  --col-space: #080e1c;
  --col-dust: #0d1424;
  --col-corona: #d4550a;
  --col-photosphere: #c8960c;
  --col-prominence: #8b1a08;
  --col-chromosphere: #e07820;
  --col-text: #ede8dc;
  --col-muted: #6b7a90;
  --col-faint: #2a3445;
  --col-earth: #1a5090;
  --col-moon: #8a8680;
  --col-data: #b8c8d8;

  --f-display: "Orbitron", monospace;
  --f-body: "Syne", sans-serif;
  --f-mono: "JetBrains Mono", monospace;

  --panel-pad: clamp(12px, 2vw, 20px);
  --card-radius: 8px;
  --border: 1px solid rgba(255, 255, 255, 0.08);
  --header-pad-x: clamp(14px, 2vw, 32px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--col-void);
  color: var(--col-text);
  font-family: var(--f-body);
}

body {
  position: relative;
}

#c3d {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

#progress-line {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--col-corona);
  box-shadow: 0 0 9px rgba(212, 85, 10, 0.45);
  z-index: 45;
  transition: width 0.4s ease;
}

#hdr {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px var(--header-pad-x) 20px;
  background: linear-gradient(180deg, rgba(4, 8, 16, 0.88) 0%, rgba(4, 8, 16, 0.36) 48%, rgba(4, 8, 16, 0) 100%);
  pointer-events: none;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-display);
  font-size: 12px;
  letter-spacing: 0.26em;
  color: rgba(237, 232, 220, 0.94);
}

.logo-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--col-corona);
  box-shadow: 0 0 7px rgba(212, 85, 10, 0.65);
  animation: pulse-dot 2s ease-in-out infinite;
}

#sec-label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.11em;
  color: rgba(184, 200, 216, 0.9);
}

#ui-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.card {
  background: rgba(4, 8, 16, 0.76);
  border: var(--border);
  border-radius: var(--card-radius);
  padding: var(--panel-pad);
  backdrop-filter: blur(16px);
}

.panel {
  position: absolute;
  pointer-events: auto;
  left: 4vw;
  right: 4vw;
  width: auto;
  max-width: none;
  max-height: min(36vh, 340px);
  top: auto;
  bottom: 2.4vh;
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 0;
  transition: opacity 0.26s ease;
}

.panel::-webkit-scrollbar {
  width: 8px;
}

.panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.panel.is-ready {
  opacity: 1;
}

.panel-pl {
  left: 4vw;
  right: 4vw;
  top: auto;
  bottom: 2.4vh;
}

.panel-pr {
  left: 4vw;
  right: 4vw;
  top: auto;
  bottom: 2.4vh;
}

.panel-pc {
  left: 4vw;
  right: 4vw;
  width: auto;
  bottom: 2.4vh;
  transform: none;
}

.panel-pb {
  left: 4vw;
  right: 4vw;
  bottom: 2.4vh;
}

.panel-pl-low {
  left: 4vw;
  right: 4vw;
  bottom: 2.4vh;
  top: auto;
}

.panel-center {
  left: 4vw;
  right: 4vw;
  top: auto;
  bottom: 2vh;
  width: auto;
  max-height: min(40vh, 360px);
  transform: none;
}

.accent-layers {
  border-color: rgba(244, 162, 97, 0.3);
}

.accent-fusion {
  border-color: rgba(200, 60, 40, 0.3);
}

.accent-distance {
  border-color: rgba(60, 160, 200, 0.3);
}

.accent-eclipse {
  border-color: rgba(140, 80, 200, 0.28);
}

.accent-color {
  border-color: rgba(200, 150, 12, 0.3);
}

.accent-space {
  border-color: rgba(6, 180, 130, 0.3);
}

.accent-earth {
  border-color: rgba(30, 120, 190, 0.28);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: rgba(184, 200, 216, 0.9);
}

.tag i {
  font-size: 11px;
  color: var(--col-corona);
}

.hero-title {
  margin: 14px 0 6px;
  font-family: var(--f-display);
  font-size: clamp(24px, 6.6vw, 36px);
  line-height: 0.98;
  letter-spacing: 0.04em;
}

.hero-title span {
  opacity: 0.45;
}

.p-title {
  margin: 12px 0;
  font-family: var(--f-display);
  font-size: clamp(20px, 6vw, 28px);
  line-height: 1.1;
}

.p-sub {
  margin: 8px 0 0;
  color: var(--col-muted);
  font-size: 13px;
  line-height: 1.45;
}

.data-chips {
  margin: 18px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 7px 9px;
  font-family: var(--f-mono);
  color: var(--col-data);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.btn-line {
  border: var(--border);
  background: transparent;
  color: var(--col-text);
  font-family: var(--f-display);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.btn-line:hover,
.btn-line.active {
  border-color: rgba(212, 85, 10, 0.58);
  color: #f0b27a;
  transform: translateY(-1px);
}

.layer-list,
.fact-grid,
.earth-grid,
.space-grid,
.sort-pool,
.sort-target {
  display: grid;
  gap: 8px;
}

.layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.22s ease, color 0.22s ease;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--col-data);
}

.layer-item:hover,
.layer-item.active {
  border-color: rgba(212, 85, 10, 0.5);
  color: #ffd5ac;
}

.layer-item .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 8px;
  display: inline-block;
}

.desc-box {
  margin-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
  color: var(--col-muted);
  line-height: 1.5;
  min-height: 72px;
  font-size: 14px;
}

.react-diagram {
  margin: 14px 0;
  border: var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: var(--f-mono);
  color: var(--col-data);
  font-size: 12px;
  line-height: 1.6;
}

.pp-chain {
  margin: 10px 0;
  display: grid;
  gap: 6px;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--col-data);
}

.fact-grid {
  grid-template-columns: 1fr;
  margin-top: 12px;
}

.fact {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  padding: 8px;
}

.fact strong {
  display: block;
  font-family: var(--f-display);
  font-size: 16px;
  color: #f1c590;
}

.fact span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--col-muted);
}

.dist-number {
  font-family: var(--f-display);
  font-size: clamp(28px, 8.2vw, 44px);
  line-height: 0.95;
  letter-spacing: 0.03em;
  margin-top: 10px;
  color: #f3c898;
}

.dist-unit {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--col-data);
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.toggle-row .btn-line {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.eclipse-btn i,
.space-item i,
.earth-item i,
.modal-title i {
  font-size: 11px;
}

.spectrum {
  margin: 12px 0;
}

.spectrum-bar {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    #5d2f99 0%,
    #2f44ab 17%,
    #1f7bc3 34%,
    #2ea66f 52%,
    #d5b014 68%,
    #df7422 84%,
    #b42a14 100%
  );
  border: var(--border);
}

.spectrum-labels {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--col-muted);
}

.comp-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 12px 0;
}

.comp-box {
  border: var(--border);
  border-radius: 8px;
  padding: 10px;
}

.comp-box .orb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  margin-bottom: 7px;
}

.comp-box .orb.white {
  background: radial-gradient(circle at 35% 35%, #ffffff, #e7e7e7 70%, #b5b5b5 100%);
}

.comp-box .orb.yellow {
  background: radial-gradient(circle at 35% 35%, #f3e09f, #e2b33a 70%, #b8771d 100%);
}

.comp-box strong {
  display: block;
  font-family: var(--f-display);
  font-size: 12px;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.comp-box span {
  font-size: 12px;
  line-height: 1.45;
  color: var(--col-muted);
}

.space-grid {
  grid-template-columns: 1fr;
  margin-top: 12px;
}

.space-item {
  border: var(--border);
  border-radius: 8px;
  padding: 9px;
}

.space-item .head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  font-family: var(--f-display);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.space-item p,
.earth-item p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--col-muted);
}

.earth-grid {
  margin-top: 14px;
  grid-template-columns: 1fr;
}

.earth-item {
  border: var(--border);
  border-radius: 8px;
  padding: 9px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.earth-item:hover {
  border-color: rgba(30, 120, 190, 0.54);
}

.earth-item .head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  font-family: var(--f-display);
  font-size: 12px;
  letter-spacing: 0.06em;
}

#floating-labels,
#earth-hotspots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fl-label,
.hs-label {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: var(--border);
  background: rgba(4, 8, 16, 0.82);
  padding: 6px 8px;
  border-radius: 6px;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--col-data);
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.fl-label i,
.hs-label i {
  color: #f3b476;
  font-size: 11px;
}

.fl-label:hover,
.hs-label:hover,
.fl-label.active {
  border-color: rgba(212, 85, 10, 0.5);
  color: #ffd8b7;
}

#nav-dots {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 35;
  display: none;
  gap: 12px;
}

.nav-dot {
  position: relative;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: transparent;
  cursor: pointer;
  transition: background 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
}

.nav-dot::after {
  content: attr(data-label);
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--col-data);
  padding: 4px 6px;
  border-radius: 4px;
  border: var(--border);
  background: rgba(4, 8, 16, 0.86);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.18s ease;
}

.nav-dot:hover::after {
  opacity: 1;
}

.nav-dot.active {
  background: var(--col-corona);
  border-color: rgba(212, 85, 10, 0.95);
  box-shadow: 0 0 6px rgba(212, 85, 10, 0.8);
}

#modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.25s ease;
}

#modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#modal-card {
  position: relative;
  width: min(480px, 92vw);
  border-color: rgba(30, 120, 190, 0.34);
  transform: scale(1);
  transition: transform 0.25s ease;
}

#modal-overlay.hidden #modal-card {
  transform: scale(0.92);
}

#modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: var(--border);
  color: var(--col-text);
  background: transparent;
  cursor: pointer;
}

.modal-title {
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-display);
  font-size: 18px;
}

.modal-body {
  margin: 0;
  color: var(--col-muted);
  line-height: 1.62;
  font-size: 14px;
}

#games-confetti-wrap {
  position: fixed;
  inset: 0;
  z-index: 65;
  pointer-events: none;
}

#confetti-canvas {
  width: 100%;
  height: 100%;
}

.game-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.game-title {
  margin: 8px 0 14px;
  font-family: var(--f-display);
  font-size: clamp(22px, 6vw, 34px);
}

.quiz-progress {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 12px;
}

.quiz-progress span {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.quiz-progress span.done {
  background: linear-gradient(90deg, #bc5f1a, #d99e2f);
}

.quiz-question {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.5;
}

.quiz-options {
  display: grid;
  gap: 8px;
}

.quiz-option {
  border: var(--border);
  border-radius: 8px;
  padding: 10px;
  color: var(--col-text);
  background: rgba(4, 8, 16, 0.62);
  text-align: left;
  cursor: pointer;
  font-family: var(--f-body);
}

.quiz-option.correct {
  border-color: rgba(70, 180, 115, 0.62);
  color: #bddfc3;
}

.quiz-option.wrong {
  border-color: rgba(190, 70, 70, 0.6);
  color: #f4b8b0;
}

.quiz-score {
  text-align: center;
  margin: 16px 0 8px;
}

.quiz-score strong {
  display: block;
  font-family: var(--f-display);
  font-size: 54px;
  line-height: 1;
  color: #f4c286;
}

.quiz-score span {
  color: var(--col-muted);
}

.sort-board {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.sort-slot,
.sort-token {
  border: var(--border);
  border-radius: 8px;
  padding: 8px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 12px;
}

.sort-token {
  cursor: grab;
  background: rgba(255, 255, 255, 0.04);
}

.sort-slot.over {
  border-color: rgba(212, 85, 10, 0.45);
}

.sort-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.sort-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.sort-feedback {
  font-size: 13px;
  color: var(--col-muted);
}

.eclipse-mini {
  margin: 10px auto;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(circle at 50% 50%, #f4d58a 0%, #d17d1f 58%, #8c3a09 100%);
  overflow: hidden;
}

.eclipse-mini .moon {
  position: absolute;
  width: 95px;
  height: 95px;
  border-radius: 50%;
  top: 2.5px;
  left: 2.5px;
  background: #111416;
  transition: transform 0.3s ease, scale 0.3s ease;
}

.eclipse-mini[data-type="ring"] .moon {
  transform: translate(0, 0) scale(0.88);
}

.eclipse-mini[data-type="total"] .moon {
  transform: translate(0, 0) scale(1.06);
  box-shadow: 0 0 0 2px rgba(237, 232, 220, 0.04);
}

.eclipse-mini[data-type="partial"] .moon {
  transform: translate(32px, 0) scale(1);
}

#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(circle at 35% 22%, #0d1424 0%, #040810 56%, #03060b 100%);
  transition: opacity 1.2s ease;
}

#loading-screen.done {
  opacity: 0;
  pointer-events: none;
}

.loading-orb {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #fff0be 0%, #e2892a 48%, #8b2d07 100%);
  box-shadow: 0 0 28px rgba(212, 85, 10, 0.45);
  position: relative;
  animation: load-spin 5.2s linear infinite;
}

.loading-orb::before,
.loading-orb::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 214, 174, 0.2);
  animation: pulse-ring 2.8s ease-in-out infinite;
}

.loading-orb::after {
  inset: -18px;
  animation-delay: 1.2s;
}

#loading-screen p {
  margin: 0;
  font-family: var(--f-display);
  font-size: 12px;
  letter-spacing: 0.29em;
  color: var(--col-text);
}

.loading-bar-shell {
  width: min(340px, 82vw);
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}

#loading-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #93400f, #d98828, #f2b35e);
  transition: width 0.25s ease;
}

@keyframes pulse-dot {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.9;
  }

  50% {
    transform: scale(1.32);
    opacity: 0.5;
  }
}

@keyframes load-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-ring {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(1);
  }

  50% {
    opacity: 0.12;
    transform: scale(1.08);
  }
}

@media (min-width: 961px) and (orientation: landscape) {
  #hdr {
    padding-top: 18px;
    padding-bottom: 34px;
  }

  #sec-label {
    font-size: 11px;
    letter-spacing: 0.14em;
  }

  #nav-dots {
    display: grid;
  }

  .panel {
    left: auto;
    right: auto;
    width: min(320px, 30vw);
    max-height: min(66vh, 560px);
    bottom: auto;
    top: 17vh;
  }

  .panel-pl {
    left: 4vw;
    right: auto;
    top: 17vh;
    bottom: auto;
  }

  .panel-pr {
    right: 4vw;
    left: auto;
    top: 17vh;
    bottom: auto;
  }

  .panel-pc {
    left: 4vw;
    right: auto;
    top: auto;
    bottom: 4vh;
    width: min(420px, 34vw);
    transform: none;
  }

  .panel-pb {
    right: 4vw;
    left: auto;
    top: auto;
    bottom: 6vh;
  }

  .panel-pl-low {
    left: 4vw;
    right: auto;
    bottom: 6vh;
    top: auto;
  }

  .panel-center {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    width: min(680px, 80vw);
    max-height: min(74vh, 620px);
    transform: translate(-50%, -50%);
  }

  .hero-title {
    font-size: clamp(34px, 4.2vw, 56px);
  }

  .p-title {
    font-size: clamp(22px, 2.4vw, 34px);
  }

  .space-grid,
  .earth-grid,
  .fact-grid,
  .sort-board,
  .comp-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sort-board,
  .comp-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dist-number {
    font-size: clamp(42px, 6.8vw, 74px);
  }
}
