:root {
  color-scheme: dark;
  --bg: #08080d;
  --panel: rgba(19, 20, 30, 0.76);
  --panel-strong: rgba(29, 30, 44, 0.92);
  --line: rgba(255, 255, 255, 0.12);
  --line-hot: rgba(116, 225, 255, 0.52);
  --text: rgba(255, 252, 239, 0.94);
  --muted: rgba(255, 252, 239, 0.64);
  --soft: rgba(255, 252, 239, 0.38);
  --cyan: #78e1ff;
  --rose: #ff8db7;
  --gold: #f4d483;
  --green: #9ee6b0;
  --danger: #ff9a9a;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.44);
  --radius: 8px;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 18% 8%, rgba(120, 225, 255, 0.12), transparent 30%),
    radial-gradient(circle at 82% 18%, rgba(255, 141, 183, 0.09), transparent 28%),
    linear-gradient(145deg, #06060a 0%, #11111a 48%, #07070c 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

button,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.23;
  z-index: 1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 3px 3px, 5px 5px;
  mix-blend-mode: screen;
}

.app-shell {
  position: relative;
  z-index: 2;
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
}

.screen {
  width: 100%;
  display: none;
  opacity: 0;
  transform: translateX(18px);
}

.screen.is-active {
  display: block;
  animation: screenIn 420ms ease forwards;
}

.intro-copy {
  padding-top: 9vh;
  animation: titleIn 900ms ease both;
}

.kicker,
.step-label {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  letter-spacing: 0;
}

h1 {
  max-width: 9em;
  font-size: clamp(3rem, 14vw, 5.6rem);
  line-height: 0.98;
  text-shadow: 0 0 28px rgba(120, 225, 255, 0.16);
}

h2 {
  font-size: clamp(1.9rem, 8vw, 3.35rem);
  line-height: 1.08;
}

.subtitle {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.subtitle-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 14px var(--rose);
}

.privacy-note {
  margin: 12vh 0 18px;
  padding: 14px 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.65;
}

.primary-action {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(120, 225, 255, 0.58);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(120, 225, 255, 0.2), rgba(255, 141, 183, 0.18)),
    rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 26px rgba(120, 225, 255, 0.13);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.primary-action.compact {
  margin-top: 18px;
}

.primary-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 34px rgba(120, 225, 255, 0.2);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.screen-head {
  margin-bottom: 22px;
}

.screen-head p:not(.step-label) {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.identity-grid,
.option-grid,
.factor-grid {
  display: grid;
  gap: 10px;
}

.identity-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.identity-card,
.option-card,
.factor-chip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.identity-card {
  position: relative;
  min-height: 132px;
  padding: 16px;
  overflow: hidden;
  animation: floatCard 5s ease-in-out infinite;
}

.identity-card:nth-child(2n) {
  animation-delay: 800ms;
}

.identity-card::after {
  content: "";
  position: absolute;
  inset: auto 12px 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(120, 225, 255, 0.55), transparent);
  opacity: 0.55;
}

.identity-card span {
  display: block;
  color: var(--soft);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
}

.identity-card strong {
  display: block;
  margin-top: 18px;
  font-family: "Noto Serif SC", serif;
  font-size: 1.2rem;
  line-height: 1.35;
}

.question-card {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.option-card {
  width: 100%;
  min-height: 52px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  line-height: 1.45;
}

.option-card::after {
  content: "";
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
}

.identity-card:hover,
.option-card:hover,
.factor-chip:hover {
  border-color: rgba(120, 225, 255, 0.44);
  box-shadow: 0 0 24px rgba(120, 225, 255, 0.12);
}

.identity-card.is-selected,
.option-card.is-selected,
.factor-chip.is-selected {
  border-color: var(--line-hot);
  background:
    linear-gradient(135deg, rgba(120, 225, 255, 0.16), rgba(255, 141, 183, 0.08)),
    var(--panel-strong);
  box-shadow: 0 0 30px rgba(120, 225, 255, 0.18);
  transform: scale(1.012);
}

.option-card.is-selected::after {
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 16px var(--cyan);
}

.inline-hint {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 0.86rem;
  line-height: 1.5;
}

.factor-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  animation: softDrop 260ms ease both;
}

.factor-panel p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.factor-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.factor-chip {
  min-height: 42px;
  padding: 10px 12px;
  text-align: center;
  color: var(--muted);
}

.factor-chip.is-selected {
  color: var(--text);
}

.moment-input {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  border: 1px solid rgba(120, 225, 255, 0.24);
  border-radius: var(--radius);
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(120, 225, 255, 0.07), rgba(255, 141, 183, 0.035)),
    rgba(4, 6, 12, 0.72);
  color: var(--text);
  line-height: 1.7;
  outline: none;
  box-shadow: inset 0 0 34px rgba(120, 225, 255, 0.06), 0 0 24px rgba(120, 225, 255, 0.08);
  animation: breathe 4.8s ease-in-out infinite;
}

.moment-input::placeholder {
  color: rgba(255, 252, 239, 0.42);
}

.moment-input:focus {
  border-color: rgba(120, 225, 255, 0.58);
}

.success-screen {
  min-height: 68vh;
  text-align: center;
}

.success-screen.is-active {
  display: grid;
  place-items: center;
}

.success-screen h2 {
  margin: 12px 0 14px;
  font-size: clamp(3rem, 17vw, 5.8rem);
}

.success-screen p:not(.step-label) {
  margin: 8px auto;
  max-width: 18em;
  color: var(--muted);
  line-height: 1.8;
}

.projector-line {
  width: 100%;
  height: 1px;
  margin-bottom: 28px;
  background: linear-gradient(90deg, transparent, rgba(255, 252, 239, 0.7), transparent);
  animation: lightsOut 1.1s ease both;
}

@keyframes titleIn {
  from {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes screenIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes floatCard {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes softDrop {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes breathe {
  0%,
  100% {
    box-shadow: inset 0 0 30px rgba(120, 225, 255, 0.05), 0 0 18px rgba(120, 225, 255, 0.06);
  }
  50% {
    box-shadow: inset 0 0 42px rgba(120, 225, 255, 0.1), 0 0 30px rgba(255, 141, 183, 0.1);
  }
}

@keyframes lightsOut {
  0% {
    opacity: 0;
    transform: scaleX(0.1);
  }
  45% {
    opacity: 1;
    transform: scaleX(1);
  }
  100% {
    opacity: 0.32;
    transform: scaleX(0.86);
  }
}

@media (min-width: 620px) {
  .app-shell {
    padding-inline: 26px;
  }

  .question-card {
    padding: 28px;
  }

  .option-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .option-grid.single {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 390px) {
  .identity-grid,
  .factor-grid {
    grid-template-columns: 1fr;
  }

  .identity-card {
    min-height: 102px;
  }
}

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