:root {
  --night-1: #01050e;
  --night-2: #020813;
  --night-3: #040f20;
  --line: rgba(152, 178, 224, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Montserrat", sans-serif;
  color: #eaf1ff;
  background:
    radial-gradient(circle at 16% -8%, rgba(80, 118, 196, 0.3), transparent 35%),
    radial-gradient(circle at 88% 0%, rgba(59, 96, 169, 0.2), transparent 30%),
    radial-gradient(circle at 50% 120%, rgba(28, 63, 126, 0.34), transparent 43%),
    linear-gradient(180deg, var(--night-1) 0%, var(--night-2) 54%, var(--night-3) 100%);
}

.night-sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -3;
}

.star {
  position: absolute;
  width: var(--size);
  height: var(--size);
  top: var(--top);
  left: var(--left);
}

.star::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #fff;
  box-shadow:
    0 0 9px rgba(255, 255, 255, 0.86),
    0 0 20px rgba(146, 195, 255, 0.35);
  animation: twinkle var(--blink) ease-in-out infinite alternate;
}

.star::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(191, 217, 255, 0.58) 0%, rgba(191, 217, 255, 0) 72%);
  filter: blur(2.5px);
  opacity: 0.8;
  animation: twinkle var(--blink) ease-in-out infinite alternate-reverse;
}

.drift {
  animation: drift-star var(--drift) ease-in-out infinite;
}

.s1 { --top: 8%; --left: 7%; --size: 2px; --drift: 24s; --dx: 28px; --dy: -16px; --blink: 2s; }
.s2 { --top: 14%; --left: 27%; --size: 3px; --drift: 30s; --dx: -26px; --dy: 16px; --blink: 2.7s; }
.s3 { --top: 20%; --left: 48%; --size: 2px; --drift: 24s; --dx: 24px; --dy: -14px; --blink: 1.8s; }
.s4 { --top: 10%; --left: 67%; --size: 2px; --drift: 32s; --dx: -28px; --dy: 19px; --blink: 2.4s; }
.s5 { --top: 18%; --left: 86%; --size: 3px; --drift: 28s; --dx: 20px; --dy: -16px; --blink: 2.2s; }
.s6 { --top: 37%; --left: 12%; --size: 2px; --drift: 25s; --dx: -23px; --dy: 15px; --blink: 2.6s; }
.s7 { --top: 46%; --left: 34%; --size: 2px; --drift: 34s; --dx: 27px; --dy: -16px; --blink: 2.4s; }
.s8 { --top: 31%; --left: 57%; --size: 3px; --drift: 27s; --dx: -22px; --dy: 13px; --blink: 2s; }
.s9 { --top: 62%; --left: 73%; --size: 2px; --drift: 33s; --dx: 24px; --dy: -14px; --blink: 2.8s; }
.s10 { --top: 78%; --left: 20%; --size: 2px; --drift: 29s; --dx: 26px; --dy: -15px; --blink: 2.3s; }
.s11 { --top: 68%; --left: 52%; --size: 2px; --drift: 30s; --dx: -20px; --dy: 12px; --blink: 2.5s; }
.s12 { --top: 56%; --left: 89%; --size: 3px; --drift: 35s; --dx: 18px; --dy: -10px; --blink: 2.9s; }

.glow {
  position: fixed;
  border-radius: 999px;
  filter: blur(90px);
  pointer-events: none;
  z-index: -2;
}

.g1 {
  width: 340px;
  height: 340px;
  top: -100px;
  left: -90px;
  background: rgba(74, 118, 210, 0.3);
}

.g2 {
  width: 300px;
  height: 300px;
  right: -70px;
  bottom: -100px;
  background: rgba(64, 106, 181, 0.26);
}

.tester-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.tester-top {
  width: min(1180px, 94vw);
  margin: 1rem auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  text-decoration: none;
  color: #f5f8ff;
  font-family: "Montserrat Alternates", sans-serif;
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  font-weight: 800;
}

.back-link {
  text-decoration: none;
  color: #c4d3f2;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.86rem;
}

.tester-main {
  width: min(1180px, 94vw);
  margin: 1rem auto 2rem;
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 1rem;
  flex: 1;
}

.tester-intro {
  border-radius: 1.2rem;
  border: 1px solid var(--line);
  background: rgba(8, 16, 32, 0.62);
  backdrop-filter: blur(10px);
  padding: clamp(1rem, 2vw, 1.5rem);
  display: grid;
  gap: 0.85rem;
  align-content: start;
}

.kicker {
  margin: 0;
  color: #b8caec;
  letter-spacing: 0.16em;
  font-weight: 700;
  font-size: 0.8rem;
}

.tester-intro h1 {
  margin: 0;
  font-family: "Montserrat Alternates", sans-serif;
  font-size: clamp(1.75rem, 3.2vw, 2.8rem);
  line-height: 1.06;
}

.tester-intro p {
  margin: 0;
  color: #d0ddf6;
  line-height: 1.55;
}

.tester-intro ul {
  margin: 0.2rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.tester-intro li {
  color: #bfd0ee;
  font-weight: 600;
}

.tester-card {
  border-radius: 1.2rem;
  background: #ffffff;
  border: 1px solid #d8e0ee;
  box-shadow: 0 20px 40px rgba(9, 18, 34, 0.26);
  padding: clamp(1rem, 2vw, 1.4rem);
  color: #14223a;
  display: grid;
  align-content: start;
  gap: 0.75rem;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.step {
  border-radius: 0.7rem;
  border: 1px solid #d5dceb;
  background: #f6f8fc;
  padding: 0.5rem 0.62rem;
  color: #6f7f9b;
  font-weight: 700;
  font-size: 0.82rem;
  text-align: center;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease, border-color 0.22s ease;
}

.step.is-active {
  border-color: #7da0e4;
  color: #2f497b;
  background: #ecf2ff;
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(68, 104, 171, 0.16);
}

.step-panel {
  border: 1px solid #e0e6f2;
  border-radius: 0.95rem;
  background: #fcfdff;
  padding: 0.9rem;
}

.step-panel.panel-in {
  animation: panel-in 0.3s ease both;
}

.step-panel h2,
#resultsView h2 {
  margin: 0 0 0.2rem;
  font-family: "Montserrat Alternates", sans-serif;
  font-size: clamp(1.3rem, 2.8vw, 1.8rem);
}

.step-panel label {
  display: grid;
  gap: 0.35rem;
  color: #556584;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  margin-top: 0.55rem;
}

.step-panel input,
.step-panel select {
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid #cfd7e5;
  background: #f8f9fc;
  color: #152238;
  font-size: 0.95rem;
  padding: 0.72rem 0.85rem;
  font-family: "Montserrat", sans-serif;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.block-title {
  margin: 0 0 0.4rem;
  color: #516280;
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.birth-location {
  margin-top: 0.55rem;
  border: 1px solid #e1e7f2;
  border-radius: 0.82rem;
  background: #f9fbff;
  padding: 0.68rem;
}

.location-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.mode-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.mode-chip input {
  position: absolute;
  opacity: 0;
}

.mode-chip span {
  border: 1px solid #d0d9ea;
  border-radius: 999px;
  padding: 0.36rem 0.62rem;
  background: #ffffff;
  color: #4e5f7e;
  font-size: 0.78rem;
  font-weight: 700;
}

.mode-chip input:checked + span {
  border-color: #7f9fe0;
  background: #e9f0ff;
  color: #2d4a7f;
}

.location-panel {
  margin-top: 0.62rem;
}

.coords-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.step-panel input:focus,
.step-panel select:focus {
  outline: none;
  border-color: #7a9ee4;
  box-shadow: 0 0 0 3px rgba(122, 158, 228, 0.16);
}

.panel-actions {
  margin-top: 0.85rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
}

.panel-actions.between {
  justify-content: space-between;
}

.btn {
  border: none;
  border-radius: 0.75rem;
  font-family: "Montserrat", sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.68rem 0.95rem;
  cursor: pointer;
}

.btn.primary {
  background: #4d78d6;
  color: #f4f8ff;
}

.btn.primary:hover {
  background: #5a86e6;
}

.btn.ghost {
  background: #eef2fb;
  color: #324978;
}

.btn.ghost:hover {
  background: #e2e9f8;
}

.meta-note {
  margin: 0;
  color: #4e5e7c;
  line-height: 1.5;
}

.quiz-meta {
  margin-top: 0.5rem;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: #5e6d87;
  font-weight: 600;
}

.progress-track {
  margin-top: 0.35rem;
  width: 100%;
  height: 0.5rem;
  border-radius: 999px;
  background: #e4eaf6;
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #5f8cea, #78a5ff);
  transition: width 0.2s ease;
}

.question-card {
  margin-top: 0.65rem;
  border: 1px solid #dbe2ef;
  border-radius: 0.9rem;
  background: #f8faff;
  padding: 0.85rem;
}

.question-card.question-pop {
  animation: question-pop 0.26s ease both;
}

.question-card p {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.45;
  color: #17243c;
}

.scale-grid {
  margin-top: 0.65rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.scale-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 0.55rem;
  border: 1px solid #d7dfec;
  border-radius: 0.72rem;
  padding: 0.52rem 0.6rem;
  background: #ffffff;
  cursor: pointer;
}

.scale-option:hover {
  background: #f5f8ff;
}

.scale-option input {
  margin-top: 0.16rem;
}

.scale-option strong {
  color: #2c4473;
}

.scale-option span {
  color: #445772;
  font-size: 0.9rem;
  line-height: 1.4;
}

.form-hint {
  min-height: 1.2em;
  margin: 0.2rem 0 0;
  color: #c24949;
  font-size: 0.84rem;
  font-weight: 600;
}

.result-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: grid;
  gap: 0.45rem;
}

.result-list li {
  border: 1px solid #d8dfee;
  background: #f8faff;
  border-radius: 0.75rem;
  padding: 0.58rem 0.7rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  color: #1c2942;
}

.result-list span {
  color: #5f7090;
}

.summary {
  margin-top: 0.55rem;
  border: 1px solid #dce3ef;
  border-radius: 0.78rem;
  background: #f8faff;
  padding: 0.62rem 0.72rem;
  color: #405474;
  font-size: 0.88rem;
  line-height: 1.5;
}

.completion-note {
  margin: 0.65rem 0 0;
  border: 1px solid #dce6f4;
  border-radius: 0.78rem;
  background: #f5f8ff;
  padding: 0.62rem 0.72rem;
  color: #324872;
  font-size: 0.88rem;
  line-height: 1.5;
  font-weight: 600;
}

#resultsView[hidden],
.step-panel[hidden] {
  display: none !important;
}

@keyframes twinkle {
  from {
    opacity: 0.3;
    transform: scale(0.72);
  }

  to {
    opacity: 1;
    transform: scale(1.18);
  }
}

@keyframes drift-star {
  0% {
    transform: translate3d(0, 0, 0);
  }

  50% {
    transform: translate3d(var(--dx), var(--dy), 0);
  }

  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

@keyframes question-pop {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

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

@media (max-width: 1024px) {
  .tester-main {
    grid-template-columns: 1fr;
  }

  .tester-intro {
    order: 1;
  }

  .tester-card {
    order: 2;
  }
}

@media (max-width: 640px) {
  .tester-top {
    margin-top: 0.75rem;
  }

  .tester-main {
    width: min(1180px, 96vw);
    margin: 0.7rem auto 1.1rem;
    gap: 0.75rem;
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .field-grid,
  .coords-grid {
    grid-template-columns: 1fr;
  }

  .panel-actions,
  .panel-actions.between {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }

  .quiz-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-list li {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .star,
  .star::before,
  .star::after {
    animation: none;
  }

  .progress-fill {
    transition: none;
  }
}
