.product-stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.product-stage[hidden],
.integrated-result[hidden],
.error-overlay[hidden] {
  display: none !important;
}

.test-stage {
  z-index: 2;
  opacity: 0;
  background: #090b0a;
  transition: opacity 430ms cubic-bezier(.2,.7,.2,1);
}

.test-stage.is-visible {
  opacity: 1;
}

.integration-veil {
  position: fixed;
  z-index: 100;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 76% 46%, rgba(15, 18, 14, 0) 0%, rgba(7, 9, 8, 0.35) 28%, rgba(3, 4, 4, 0.98) 73%),
    #020302;
  transition: opacity 150ms cubic-bezier(.36,.02,.68,.2), visibility 0s linear 150ms;
}

.integration-veil.is-covering {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.quiz-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
}

.quiz-controls p {
  margin: 0;
  color: rgba(238, 233, 223, 0.3);
  font: 8px/1.5 monospace;
  letter-spacing: 0.12em;
  text-align: right;
}

.previous-action {
  min-width: 112px;
  min-height: 48px;
  padding: 0;
  color: rgba(238, 233, 223, 0.62);
  border: 0;
  border-bottom: 1px solid rgba(238, 233, 223, 0.14);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.previous-action:disabled {
  opacity: 0.24;
  cursor: default;
}

.answer-button[aria-pressed="true"] {
  border-color: rgba(187, 161, 113, 0.44);
  background: rgba(187, 161, 113, 0.07);
}

.trace-path {
  transition: stroke-dashoffset 540ms cubic-bezier(.2,.75,.15,1);
}

.trace-nodes circle.is-active {
  opacity: 1;
  transform: scale(1);
}

.integrated-result {
  position: absolute;
  z-index: 18;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: max(76px, calc(env(safe-area-inset-top) + 60px)) 18px max(34px, env(safe-area-inset-bottom));
  color: var(--ivory);
  background:
    linear-gradient(180deg, rgba(9, 11, 10, 0.18), rgba(9, 11, 10, 0.82) 48%, #090b0a 100%);
  opacity: 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  transition: opacity 620ms ease;
}

.integrated-result.is-visible {
  opacity: 1;
}

.integrated-result__layout {
  display: grid;
  gap: 18px;
  width: min(100%, 720px);
  margin: 0 auto;
  padding-bottom: 30px;
}

.integrated-result__hero,
.integrated-result__section {
  position: relative;
  border: 1px solid rgba(238, 233, 223, 0.09);
  background: rgba(15, 20, 17, 0.76);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.25);
  -webkit-backdrop-filter: blur(7px) saturate(104%);
  backdrop-filter: blur(7px) saturate(104%);
}

.integrated-result__hero {
  overflow: hidden;
  padding: clamp(34px, 7vw, 62px) clamp(24px, 6vw, 54px);
  background:
    linear-gradient(145deg, rgba(31, 41, 36, 0.86), rgba(11, 15, 13, 0.91) 72%);
}

.integrated-result__hero::before {
  position: absolute;
  inset: 0;
  opacity: 0.38;
  background-image:
    linear-gradient(90deg, transparent 0 78%, rgba(187, 161, 113, 0.09) 78% 78.2%, transparent 78.2%),
    linear-gradient(0deg, transparent 0 28%, rgba(112, 128, 120, 0.11) 28% 28.2%, transparent 28.2%);
  background-size: 112px 86px;
  content: "";
  pointer-events: none;
}

.integrated-result__hero > * {
  position: relative;
  z-index: 1;
}

.integrated-result__kicker {
  margin: 24px 0 9px;
  color: rgba(238, 233, 223, 0.58);
  font-size: 12px;
  letter-spacing: 0.13em;
}

.integrated-result__code {
  position: absolute;
  top: clamp(34px, 7vw, 62px);
  right: clamp(24px, 6vw, 54px);
  margin: 0;
  color: rgba(187, 161, 113, 0.42);
  font: 8px/1 monospace;
  letter-spacing: 0.18em;
}

.integrated-result__hero h2 {
  max-width: 560px;
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(46px, 10vw, 76px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.integrated-result__short {
  max-width: 560px;
  margin: 19px 0 0;
  color: rgba(238, 233, 223, 0.66);
  font-size: 14px;
  line-height: 1.8;
}

.integrated-result__share {
  margin: 29px 0 0;
  padding: 17px 18px;
  color: rgba(238, 233, 223, 0.82);
  font-family: Georgia, "Songti SC", serif;
  font-size: 15px;
  line-height: 1.75;
  border-top: 1px solid rgba(238, 233, 223, 0.11);
  border-bottom: 1px solid rgba(238, 233, 223, 0.07);
  background: rgba(255, 255, 255, 0.018);
}

.integrated-result__section {
  padding: 26px 22px;
}

.integrated-result__heading {
  display: flex;
  align-items: baseline;
  gap: 13px;
}

.integrated-result__heading p {
  margin: 0;
  color: var(--champagne);
  font: 700 10px/1 monospace;
  letter-spacing: 0.14em;
}

.integrated-result__heading h3,
.secondary-result h3 {
  margin: 0;
  color: var(--ivory);
  font-family: Georgia, "Songti SC", serif;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.45;
}

.integrated-result__note {
  margin: 13px 0 24px;
  color: rgba(238, 233, 223, 0.36);
  font-size: 11px;
  line-height: 1.7;
}

.balance-message {
  margin: 0 0 18px;
  padding: 11px 13px;
  color: rgba(208, 180, 125, 0.88);
  font-size: 12px;
  letter-spacing: 0.08em;
  border: 1px solid rgba(187, 161, 113, 0.13);
  background: rgba(187, 161, 113, 0.045);
}

.dimension-bars {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 11px;
  align-items: end;
}

.dimension-index {
  display: grid;
  grid-template-rows: 154px auto;
  gap: 11px;
  min-width: 0;
  text-align: center;
}

.dimension-index__meter {
  position: relative;
  height: 154px;
  overflow: hidden;
  border-bottom: 1px solid rgba(238, 233, 223, 0.12);
  background: repeating-linear-gradient(to top, transparent 0 30px, rgba(238, 233, 223, 0.045) 30px 31px);
}

.dimension-index__meter::before {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  background: rgba(112, 128, 120, 0.18);
  content: "";
}

.dimension-index__fill {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 9px;
  height: var(--index-level);
  border: 1px solid rgba(112, 128, 120, 0.5);
  border-bottom: 0;
  background: rgba(35, 61, 49, 0.28);
  transform: translateX(-50%) scaleY(0);
  transform-origin: center bottom;
  transition: transform 850ms var(--index-delay) cubic-bezier(.17,.77,.2,1);
}

.integrated-result.is-visible .dimension-index__fill {
  transform: translateX(-50%) scaleY(1);
}

.dimension-index.is-primary .dimension-index__fill {
  border-color: rgba(187, 161, 113, 0.68);
  background: linear-gradient(to top, rgba(35, 61, 49, 0.32), rgba(187, 161, 113, 0.5));
}

.dimension-index.is-secondary .dimension-index__fill {
  border-color: rgba(112, 128, 120, 0.56);
  background: linear-gradient(to top, rgba(35, 61, 49, 0.36), rgba(112, 128, 120, 0.48));
}

.dimension-index__copy {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  min-height: 42px;
}

.dimension-index__label {
  width: 100%;
  color: rgba(238, 233, 223, 0.7);
  font-size: 11px;
}

.tendency-tag {
  padding: 3px 6px;
  color: rgba(208, 180, 125, 0.84);
  font-size: 9px;
  border: 1px solid rgba(187, 161, 113, 0.12);
}

.integrated-result__description,
.secondary-result p:last-child {
  margin: 19px 0 0;
  color: rgba(238, 233, 223, 0.64);
  font-size: 14px;
  line-height: 2;
}

.insight-list {
  display: grid;
  gap: 11px;
  margin: 19px 0 0;
  padding: 0;
  list-style: none;
}

.insight-list li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
  padding: 13px 0;
  color: rgba(238, 233, 223, 0.65);
  font-size: 14px;
  line-height: 1.75;
  border-top: 1px solid rgba(238, 233, 223, 0.07);
}

.insight-list li span {
  color: rgba(187, 161, 113, 0.66);
  font: 10px/1.75 monospace;
  letter-spacing: 0.08em;
}

.secondary-result {
  background: rgba(25, 39, 32, 0.74);
  border-color: rgba(112, 128, 120, 0.19);
}

.secondary-result__label {
  margin: 0 0 9px;
  color: rgba(143, 167, 154, 0.8);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.integrated-result__actions {
  padding: 16px 2px 2px;
  text-align: center;
}

.retest-action {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  width: min(100%, 330px);
  min-height: 56px;
  padding: 0 18px;
  color: var(--ivory);
  border: 0;
  border-top: 1px solid rgba(238, 233, 223, 0.24);
  border-bottom: 1px solid rgba(238, 233, 223, 0.1);
  background: rgba(8, 11, 9, 0.25);
  cursor: pointer;
}

.integrated-result__actions p {
  margin: 14px auto 0;
  max-width: 480px;
  color: rgba(238, 233, 223, 0.3);
  font-size: 10px;
  line-height: 1.7;
}

.editorial-reveal {
  opacity: 0.16;
  filter: blur(4px);
  transform: translate3d(0, 16px, 0);
  transition: opacity 620ms ease, filter 720ms ease, transform 720ms cubic-bezier(.2,.72,.25,1);
}

.editorial-reveal.is-revealed {
  opacity: 1;
  filter: blur(0);
  transform: none;
}

.error-overlay {
  position: fixed;
  z-index: 140;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 26px;
  background: rgba(5, 7, 6, 0.94);
}

.error-overlay__panel {
  width: min(100%, 460px);
  padding: 34px 28px;
  color: rgba(238, 233, 223, 0.82);
  border: 1px solid rgba(238, 233, 223, 0.11);
  background: rgba(15, 20, 17, 0.9);
}

.error-overlay__panel p {
  margin: 0 0 18px;
  color: rgba(187, 161, 113, 0.62);
  font: 9px/1 monospace;
  letter-spacing: 0.2em;
}

.error-overlay__panel h2 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: 25px;
  font-weight: 400;
  line-height: 1.55;
}

.error-overlay__panel button {
  min-width: 150px;
  min-height: 50px;
  margin-top: 26px;
  color: rgba(238, 233, 223, 0.76);
  border: 0;
  border-top: 1px solid rgba(238, 233, 223, 0.18);
  border-bottom: 1px solid rgba(238, 233, 223, 0.08);
  background: transparent;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .previous-action:hover:not(:disabled),
  .retest-action:hover,
  .error-overlay__panel button:hover {
    background: rgba(187, 161, 113, 0.055);
  }
}

@media (max-width: 680px) {
  .quiz-controls {
    margin-top: 14px;
  }

  .quiz-controls p {
    max-width: 48%;
    font-size: 7px;
  }

  .previous-action {
    min-width: 104px;
  }

  .integrated-result {
    padding-right: 14px;
    padding-left: 14px;
  }

  .integrated-result__layout {
    gap: 14px;
  }

  .integrated-result__hero {
    padding: 34px 22px;
  }

  .integrated-result__code {
    top: 35px;
    right: 22px;
  }

  .integrated-result__hero h2 {
    font-size: clamp(42px, 13vw, 58px);
  }

  .integrated-result__section {
    padding: 23px 18px;
  }

  .dimension-bars {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px 10px;
  }

  .dimension-index {
    grid-template-rows: 118px auto;
  }

  .dimension-index__meter {
    height: 118px;
  }
}

@media (max-height: 700px) {
  .quiz-controls {
    margin-top: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .test-stage,
  .integration-veil,
  .integrated-result,
  .dimension-index__fill,
  .editorial-reveal,
  .trace-path {
    transition-duration: 180ms !important;
  }

  .editorial-reveal {
    opacity: 1;
    filter: none;
    transform: none;
  }
}
