:root {
  --navy: #0b1f3a;
  --navy-soft: #16365f;
  --sky: #dff6ff;
  --mint: #b8f0e3;
  --cyan: #5ec8e8;
  --cyan-deep: #2aa8cf;
  --sand: #f7e7c8;
  --blush: #ffb7c5;
  --ink: #12263a;
  --muted: #5b708a;
  --card: rgba(255, 255, 255, 0.92);
  --shadow: 0 18px 50px rgba(11, 31, 58, 0.18);
  --radius: 22px;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

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

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: linear-gradient(165deg, #9fdfff 0%, #c9f0ff 28%, #e8f7ff 55%, #f4fbff 100%);
  overflow-x: hidden;
}

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

.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 12% 18%, rgba(255, 255, 255, 0.95), transparent),
    radial-gradient(1.5px 1.5px at 28% 42%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(2px 2px at 70% 22%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1.5px 1.5px at 82% 58%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(2px 2px at 48% 72%, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(1.5px 1.5px at 18% 78%, rgba(255, 255, 255, 0.7), transparent);
  animation: twinkle 4.5s ease-in-out infinite alternate;
}

.planet {
  position: absolute;
  border-radius: 50%;
  filter: blur(0.2px);
}

.planet-a {
  width: 160px;
  height: 160px;
  right: -40px;
  top: 12%;
  background: radial-gradient(circle at 35% 35%, #fff6d1 0%, #ffc978 55%, #f09a5a 100%);
  opacity: 0.55;
  animation: drift 12s ease-in-out infinite alternate;
}

.planet-b {
  width: 90px;
  height: 90px;
  left: -20px;
  bottom: 18%;
  background: radial-gradient(circle at 40% 35%, #e8fff8, #7fe0c8 60%, #3fb89a 100%);
  opacity: 0.45;
  animation: drift 10s ease-in-out infinite alternate-reverse;
}

@keyframes twinkle {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

@keyframes drift {
  from { transform: translateY(0); }
  to { transform: translateY(18px); }
}

@keyframes bob {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

@keyframes orbit {
  from { transform: rotate(0deg) translateX(52px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(52px) rotate(-360deg); }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.app {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.screen {
  display: none;
  animation: pop-in 0.45s ease both;
}

.screen.is-active {
  display: block;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(11, 31, 58, 0.08);
  font-size: 13px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: 0.02em;
}

.brand-rocket {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(11, 31, 58, 0.15));
}

.hero-mascots {
  position: relative;
  display: grid;
  place-items: center;
  margin: 28px 0 8px;
  min-height: 210px;
}

.hero-daybear {
  width: min(210px, 58vw);
  height: auto;
  filter: drop-shadow(0 14px 24px rgba(11, 31, 58, 0.18));
  animation: bob 2.8s ease-in-out infinite alternate;
}

.float-rocket {
  position: absolute;
  top: 8px;
  right: 18px;
  width: 72px;
  height: auto;
  animation: bob 2.2s ease-in-out infinite alternate-reverse;
  filter: drop-shadow(0 8px 14px rgba(11, 31, 58, 0.2));
}

.eyebrow {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--cyan-deep);
  letter-spacing: 0.04em;
}

h1 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 7vw, 2.35rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--navy);
}

h1.start-title {
  margin: 0 0 14px;
  font-size: clamp(0.98rem, 4vw, 1.45rem);
  line-height: 1.3;
  letter-spacing: -0.04em;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  max-width: 100%;
}

.lead {
  margin: 0 0 28px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--muted);
}

.lead strong {
  color: var(--navy-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 14px 18px;
  border: 0;
  border-radius: 16px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn-primary {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-soft) 100%);
  color: #fff;
  box-shadow: 0 12px 28px rgba(11, 31, 58, 0.28);
}

.btn-primary:hover {
  box-shadow: 0 14px 32px rgba(11, 31, 58, 0.34);
}

.btn-ghost {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--navy);
  border: 1px solid rgba(11, 31, 58, 0.1);
}

.btn-apply {
  margin-top: 10px;
  background: linear-gradient(135deg, #1f7a8c 0%, #2aa8cf 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(42, 168, 207, 0.28);
}

.btn-apply:hover {
  box-shadow: 0 12px 28px rgba(42, 168, 207, 0.36);
}

.btn-link {
  margin-top: 10px;
  background: transparent;
  color: var(--cyan-deep);
  min-height: 44px;
  font-size: 14px;
}

.btn-icon {
  font-size: 18px;
}

.fine {
  margin: 14px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* Quiz */
.quiz-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 22px;
}

.link-back,
.link-home {
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--navy);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0 10px;
  white-space: nowrap;
}

.link-back {
  min-width: 72px;
}

.link-home {
  color: var(--cyan-deep);
}

.progress-wrap {
  flex: 1;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-soft);
  letter-spacing: 0.04em;
}

.progress-rocket {
  width: 26px;
  height: 26px;
  object-fit: contain;
  transition: transform 0.35s ease;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  overflow: hidden;
  border: 1px solid rgba(11, 31, 58, 0.06);
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), #7ee0b8);
  transition: width 0.35s ease;
}

.quiz-body {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 18px 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.8);
  text-align: center;
}

.quiz-buddy {
  width: 68px;
  height: auto;
  margin-bottom: 6px;
  animation: bob 2.4s ease-in-out infinite alternate;
}

.q-kicker {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--cyan-deep);
  letter-spacing: 0.06em;
}

.q-text {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 5vw, 1.4rem);
  line-height: 1.4;
  color: var(--navy);
}

.choices {
  display: grid;
  gap: 10px;
}

.choice {
  width: 100%;
  min-height: 64px;
  padding: 16px 16px;
  border-radius: 16px;
  border: 2px solid rgba(11, 31, 58, 0.08);
  background: #f7fbff;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

/* 터치 기기에서 :hover 가 다음 문항까지 남는 sticky hover 방지 */
@media (hover: hover) and (pointer: fine) {
  .choice:hover {
    border-color: var(--cyan);
    background: #eef9ff;
  }
}

.choice:focus {
  outline: none;
}

.choice:focus-visible {
  border-color: var(--cyan);
  background: #eef9ff;
  outline: 2px solid rgba(56, 189, 248, 0.45);
  outline-offset: 2px;
}

.choice.is-selected {
  border-color: var(--cyan);
  background: #eef9ff;
}

.choice:active {
  transform: scale(0.99);
}

.choice span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan-deep);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}

/* Loading */
.screen-loading {
  text-align: center;
  padding-top: 18vh;
}

.loading-orbit {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto 22px;
}

.loading-daybear {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 120px;
  height: auto;
  animation: bob 1.6s ease-in-out infinite alternate;
}

.loading-rocket {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52px;
  height: auto;
  margin: -26px 0 0 -26px;
  animation: orbit 2.4s linear infinite;
  filter: drop-shadow(0 6px 10px rgba(11, 31, 58, 0.2));
}

.screen-loading h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--navy);
}

/* Result */
.result-card {
  position: relative;
  background: var(--card);
  border-radius: 28px;
  padding: 28px 20px 22px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.85);
  text-align: center;
  overflow: hidden;
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 110px;
  background:
    radial-gradient(circle at 20% 40%, rgba(94, 200, 232, 0.35), transparent 45%),
    radial-gradient(circle at 80% 30%, rgba(255, 183, 197, 0.35), transparent 40%),
    linear-gradient(180deg, #e8f8ff, transparent);
  pointer-events: none;
}

.result-ribbon {
  position: relative;
  display: inline-block;
  margin-bottom: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--sand);
  color: #8a5a1a;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.result-daybear {
  position: relative;
  width: 108px;
  height: auto;
  margin: 4px auto 8px;
  animation: bob 2.6s ease-in-out infinite alternate;
}

.result-title {
  position: relative;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.result-name {
  position: relative;
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 5vw, 1.55rem);
  line-height: 1.38;
  color: var(--navy);
  word-break: keep-all;
  overflow-wrap: break-word;
}

.result-name .name-sub,
.alts-list .name-sub {
  display: inline-block;
  margin-top: 2px;
  font-size: 0.88em;
  font-weight: 700;
  color: var(--navy-soft);
  opacity: 0.92;
}

.alts-list strong {
  font-size: 13px;
  color: var(--navy);
  line-height: 1.4;
  word-break: keep-all;
}

.result-tags {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
}

.tag {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(94, 200, 232, 0.18);
  color: var(--navy-soft);
  font-size: 12px;
  font-weight: 800;
}

.result-vibe {
  position: relative;
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--cyan-deep);
}

.result-blurb {
  position: relative;
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
}

.result-meta {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 16px;
  padding: 12px 8px;
  border-radius: 16px;
  background: #f3f9ff;
}

.result-meta div {
  margin: 0;
}

.result-meta .meta-wide {
  grid-column: 1 / -1;
}

.result-meta dt {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 4px;
}

.result-meta dd {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.35;
}

.result-alts {
  position: relative;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(11, 31, 58, 0.04);
  text-align: left;
}

.alts-label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.alts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.alts-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(11, 31, 58, 0.06);
}

.alts-list span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.chem {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  text-align: left;
}

.chem > div {
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff8ef, #fff);
  border: 1px solid rgba(240, 186, 120, 0.35);
}

.chem-label {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 800;
  color: #b07a2e;
}

.chem-value {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.4;
}

.result-actions {
  margin-top: 18px;
}

#share-toast {
  color: var(--cyan-deep);
  font-weight: 700;
}

@media (min-width: 480px) {
  .app {
    padding-top: 40px;
  }
}
