:root {
  --navy: #2c3e50;
  --softgray: #ecf0f1;
  --teal: #1abc9c;
  --gold: #f1c40f;
  --slate: #7f8c8d;
  --coral: #e74c3c;
  --white: #ffffff;
  --gray-100: #f7fafc;
  --gray-200: #edf2f7;
  --gray-300: #e2e8f0;
  --max-width: 1120px;
  --container-pad: 16px;
  --radius: 10px;
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.06);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.06);
  --bg-space: #0a0a1a;
  --text-dim: #8899aa;
  --panel-bg: rgba(10, 10, 26, 0.85);
}

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

html,
body {
  height: 100%;
}

body {
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial;
  color: var(--white);
  background: var(--bg-space);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ── Buttons (SimpliPhys standard) ── */

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 0.375rem;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
}

.navy-btn {
  background-color: rgba(44, 62, 80, 0.8);
  color: white;
}

.navy-btn:hover {
  background-color: rgba(44, 62, 80, 0.7);
  transform: translateY(-2px);
}

.teal-btn {
  background-color: rgba(26, 188, 156, 0.8);
  color: white;
}

.teal-btn:hover {
  background-color: rgba(26, 188, 156, 0.7);
  transform: translateY(-2px);
}

/* ── Page header (SimpliPhys standard) ── */

.page-header {
  text-align: center;
  color: var(--white);
  padding: 1rem;
  position: relative;
  z-index: 30;
}

.header-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.header-left {
  justify-self: start;
}

.page-title {
  margin: 0;
  justify-self: center;
  font-size: 2rem;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
}

.header-actions {
  justify-self: end;
}

@media (max-width: 767px) {
  .header-grid {
    grid-template-columns: 1fr;
    grid-auto-flow: row;
    text-align: left;
  }
  .page-title {
    justify-self: start;
    font-size: 1.5rem;
  }
  .header-actions {
    justify-self: start;
    width: 100%;
    margin-top: 8px;
  }
}

/* ── Fixed canvas ── */

canvas#space-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ── Scroll container ── */

.scroll-container {
  width: 100%;
  position: relative;
}

/* ── Aim panel (SimpliPhys panel style) ── */

.aim-section {
  position: relative;
  z-index: 10;
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 24px 40px;
  text-align: center;
}

.aim-panel {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 28px;
  box-shadow: var(--shadow-sm);
}

.aim-panel p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--navy);
}

.aim-panel strong {
  color: var(--teal);
}

.scroll-hint {
  margin-top: 32px;
  font-size: 0.85rem;
  color: var(--text-dim);
  animation: pulse 2s ease-in-out infinite;
}

.scroll-hint .arrow {
  display: block;
  font-size: 1.4rem;
  margin-top: 8px;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ── Left info panel ── */

.info-panel {
  position: fixed;
  top: 50%;
  left: 24px;
  transform: translateY(-50%);
  z-index: 20;
  max-width: 280px;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(12px);
  transition: opacity 0.4s ease;
}

.info-panel.hidden {
  opacity: 0;
  pointer-events: none;
}

.info-panel .stage-number {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 8px;
}

.info-panel .stage-name {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 6px;
  transition: opacity 0.3s;
}

.info-panel .stage-size {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 12px;
}

.info-panel .stage-note {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-dim);
}

/* ── Right progress indicator ── */

.progress-bar {
  position: fixed;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: opacity 0.4s ease;
}

.progress-bar.hidden {
  opacity: 0;
  pointer-events: none;
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.progress-dot.active {
  background: var(--teal);
  border-color: var(--teal);
  box-shadow: 0 0 8px rgba(26, 188, 156, 0.5);
  transform: scale(1.3);
}

.progress-dot.visited {
  background: rgba(26, 188, 156, 0.4);
  border-color: rgba(26, 188, 156, 0.5);
}

.progress-dot .tooltip {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 0.7rem;
  color: var(--text-dim);
  background: var(--panel-bg);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.progress-dot:hover .tooltip {
  opacity: 1;
}

/* ── Summary table (SimpliPhys panel + table style) ── */

.summary-section {
  position: relative;
  z-index: 10;
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.summary-panel {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.summary-panel h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 24px;
  text-align: center;
  color: var(--navy);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--white);
  border: 1px solid var(--softgray);
}

.results-table th,
.results-table td {
  border: 1px solid var(--softgray);
  padding: 12px 16px;
  text-align: left;
}

.results-table thead tr {
  background: var(--softgray);
}

.results-table th {
  font-weight: 700;
  color: var(--navy);
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.results-table td {
  color: var(--slate);
}

.results-table .object-name {
  color: var(--navy);
  font-weight: 600;
}

.results-table .highlight {
  color: var(--teal);
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
}

/* ── Back link ── */

.back-link {
  position: fixed;
  top: 20px;
  left: 24px;
  z-index: 30;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius);
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  transition: all 0.2s;
}

.back-link:hover {
  color: var(--teal);
  border-color: rgba(26, 188, 156, 0.3);
}

/* ── Responsive ── */

@media (max-width: 900px) {
  .info-panel {
    left: 12px;
    max-width: 220px;
    padding: 16px;
  }

  .info-panel .stage-name {
    font-size: 1.1rem;
  }

  .info-panel .stage-note {
    font-size: 0.78rem;
  }

  .progress-bar {
    right: 12px;
  }
}

@media (max-width: 768px) {
  .info-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: none;
    transform: none;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 16px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    align-items: baseline;
  }

  .info-panel .stage-number {
    width: 100%;
    margin-bottom: 2px;
  }

  .info-panel .stage-name {
    font-size: 1rem;
  }

  .info-panel .stage-size {
    margin-bottom: 0;
  }

  .info-panel .stage-note {
    width: 100%;
  }

  .progress-bar {
    top: 20px;
    right: 12px;
    transform: none;
    flex-direction: row;
    gap: 8px;
  }

  .progress-dot .tooltip {
    right: auto;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
  }
}
