:root {
  color-scheme: dark;
  --ink: #f5f0e8;
  --muted: #b5b8c7;
  --paper: #11141d;
  --panel: rgba(20, 23, 33, 0.88);
  --line: rgba(244, 239, 230, 0.14);
  --blue: #78a8f0;
  --rose: #f17c9a;
  --green: #8ecb7f;
  --gold: #efbd55;
  --lavender: #ad91ef;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: #050712;
  overflow-x: hidden;
}

button {
  font: inherit;
}

.ambient-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 22%, rgba(104, 74, 170, 0.22), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(78, 132, 214, 0.18), transparent 30%),
    radial-gradient(circle at 72% 84%, rgba(241, 124, 154, 0.13), transparent 34%),
    linear-gradient(135deg, #040611 0%, #090d1d 44%, #150d1d 100%);
}

.ambient-scene::before,
.ambient-scene::after {
  position: absolute;
  inset: -12%;
  content: "";
  pointer-events: none;
}

.ambient-scene::before {
  background:
    radial-gradient(ellipse at 18% 30%, rgba(173, 145, 239, 0.18), transparent 32%),
    radial-gradient(ellipse at 88% 62%, rgba(120, 168, 240, 0.16), transparent 34%),
    radial-gradient(ellipse at 46% 85%, rgba(241, 124, 154, 0.12), transparent 30%);
  filter: blur(18px);
  mix-blend-mode: screen;
  animation: nebulaDrift 20s ease-in-out infinite alternate;
}

.ambient-scene::after {
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 90px 90px;
  mask-image: radial-gradient(circle at center, transparent 18%, black 50%, transparent 78%);
  opacity: 0.22;
  transform: rotate(-8deg);
}

.ambient-cosmos {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0 24px;
  display: grid;
  align-content: center;
  gap: 18px;
}

.quiz-card,
.site-footer {
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), transparent 42%),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.quiz-card {
  border-radius: 24px;
  padding: clamp(18px, 3vw, 34px);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  font-size: clamp(1.1rem, 1.8vw, 1.45rem);
  line-height: 1.2;
  font-weight: 850;
}

h1 span {
  display: block;
}

.soft-stamp {
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  border-radius: 22px;
  position: relative;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(120, 168, 240, 0.2), rgba(241, 124, 154, 0.18));
  border: 1px solid var(--line);
  overflow: hidden;
}

.soft-stamp span {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e2ac46, #d96a83);
  opacity: 0.85;
}

.soft-stamp b {
  position: relative;
  color: white;
  font-size: 1.6rem;
  text-shadow: 0 2px 10px rgba(30, 20, 28, 0.2);
}

.intro {
  max-width: 680px;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.quiz-view,
.result-view {
  margin-top: 24px;
}

.progress-line {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.progress-track {
  height: 9px;
  border-radius: 999px;
  background: rgba(30, 34, 45, 0.08);
  overflow: hidden;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--rose), var(--gold));
  transition: width 240ms ease;
}

.question-panel {
  margin-top: 16px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(18, 21, 31, 0.74);
}

.question-kicker {
  margin: 0 0 8px;
  color: var(--rose);
  font-weight: 800;
  font-size: 0.88rem;
}

.question-panel h2 {
  margin: 0;
  font-size: clamp(1.14rem, 2.6vw, 1.8rem);
  line-height: 1.25;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.answer-option {
  min-height: 104px;
  padding: 15px;
  border: 1px solid rgba(32, 33, 43, 0.12);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(28, 32, 45, 0.92);
  text-align: left;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.answer-option:hover,
.answer-option:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(93, 143, 214, 0.46);
  background: rgba(35, 40, 56, 0.96);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
  outline: none;
}

.answer-option.is-selected {
  border-color: rgba(217, 106, 131, 0.72);
  box-shadow: 0 0 0 4px rgba(217, 106, 131, 0.14);
}

.answer-option strong,
.answer-option span {
  display: block;
}

.answer-option strong {
  font-size: 1rem;
}

.answer-option span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.nav-row,
.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-row {
  justify-content: space-between;
  margin-top: 16px;
}

.ghost-button,
.primary-button,
.share-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 17px;
  color: var(--ink);
  background: rgba(26, 30, 42, 0.8);
  cursor: pointer;
}

.ghost-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.primary-button {
  margin-top: 18px;
  color: white;
  border: 0;
  background: linear-gradient(135deg, var(--blue), var(--lavender));
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(91, 110, 214, 0.22);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.primary-button:hover,
.primary-button:focus-visible,
.download-certificate-button:hover,
.download-certificate-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(91, 110, 214, 0.28);
  outline: none;
}

.result-label {
  margin: 0 0 8px;
  color: var(--rose);
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.82rem;
}

.result-view h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2.3rem);
}

.result-view p {
  color: var(--muted);
  line-height: 1.58;
}

.score-meters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.meter {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(25, 29, 41, 0.74);
}

.meter strong {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.92rem;
}

.meter-track {
  height: 9px;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(32, 33, 43, 0.08);
  overflow: hidden;
}

.meter-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.meter.hiki .meter-track span {
  background: var(--rose);
}

.meter.neet .meter-track span {
  background: var(--blue);
}

.meter.iso .meter-track span {
  background: var(--green);
}

.result-advice {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(142, 203, 127, 0.14);
  color: #d8ecd2;
  line-height: 1.55;
}

.share-score {
  margin-top: 18px;
  padding: clamp(16px, 3vw, 24px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(circle at 12% 12%, rgba(241, 124, 154, 0.16), transparent 28%),
    radial-gradient(circle at 88% 20%, rgba(120, 168, 240, 0.16), transparent 30%),
    rgba(20, 24, 35, 0.78);
}

.share-score h3 {
  margin: 0 0 12px;
}

.certificate-name-field {
  display: grid;
  gap: 7px;
  max-width: 360px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.certificate-name-field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(244, 239, 230, 0.16);
  border-radius: 14px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(12, 15, 24, 0.72);
  outline: none;
}

.certificate-name-field input:focus {
  border-color: rgba(241, 124, 154, 0.58);
  box-shadow: 0 0 0 4px rgba(241, 124, 154, 0.12);
}

.certificate-frame {
  width: min(100%, 620px);
  padding: 10px;
  border: 1px solid rgba(245, 240, 232, 0.18);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(245, 240, 232, 0.14), rgba(245, 240, 232, 0.03)),
    rgba(9, 11, 18, 0.46);
  box-shadow:
    0 22px 54px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: rotate(-0.4deg);
  transition:
    transform 220ms ease,
    box-shadow 220ms ease;
}

.certificate-frame:hover {
  transform: rotate(0deg) translateY(-2px);
  box-shadow:
    0 28px 68px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#certificatePreview {
  display: block;
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(245, 240, 232, 0.14);
}

.share-actions {
  margin-top: 12px;
}

.share-button {
  font-weight: 800;
}

.facebook {
  border-color: rgba(24, 119, 242, 0.22);
}

.x {
  border-color: rgba(32, 33, 43, 0.24);
}

.instagram {
  border-color: rgba(217, 106, 131, 0.32);
}

.download {
  border-color: rgba(118, 168, 107, 0.32);
}

.download-certificate-button {
  min-height: 50px;
  margin-top: 16px;
  border: 0;
  border-radius: 999px;
  padding: 0 22px;
  color: #17121d;
  background: linear-gradient(135deg, #f6d77c, #f19bb1 48%, #8ecb7f);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(241, 124, 154, 0.18);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

.download-certificate-button:hover {
  filter: saturate(1.08) brightness(1.03);
}

.site-footer {
  border-radius: 20px;
  padding: 16px 18px;
  display: grid;
  gap: 10px;
}

.site-footer strong {
  color: #f5f0e8;
}

.site-footer small {
  color: var(--muted);
  line-height: 1.45;
}

.compact {
  margin-top: 0;
}

.copy-status {
  min-height: 1.2em;
  margin: 0;
  color: var(--green);
  font-size: 0.86rem;
  font-weight: 750;
}

@keyframes nebulaDrift {
  from {
    transform: translate3d(-1%, -1%, 0) scale(1);
  }

  to {
    transform: translate3d(1.5%, 1%, 0) scale(1.05);
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 18px, 980px);
    padding: 12px 0;
  }

  .quiz-card {
    border-radius: 18px;
  }

  .soft-stamp {
    width: 58px;
    height: 58px;
    border-radius: 18px;
  }

  .progress-line,
  .answer-grid,
  .score-meters {
    grid-template-columns: 1fr;
  }

  .answer-option {
    min-height: auto;
  }

  .certificate-frame {
    padding: 6px;
    border-radius: 18px;
  }
}

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