:root {
  --bg: #edf7ff;
  --bg-soft: #f7fbff;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --ink: #26365f;
  --muted: #657292;
  --soft: #e7f0ff;
  --line: rgba(80, 128, 210, 0.22);
  --primary: #657eff;
  --primary-deep: #3157da;
  --primary-soft: #dbe7ff;
  --cyan: #89d8ff;
  --sun: #ffe68c;
  --rose: #ffddeb;
  --shadow: 0 24px 70px rgba(55, 93, 170, 0.18);
  --tight-shadow: 0 12px 34px rgba(55, 93, 170, 0.12);
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.96), transparent 24%),
    radial-gradient(circle at 78% 18%, rgba(110, 164, 255, 0.34), transparent 28%),
    radial-gradient(circle at 50% 82%, rgba(255, 255, 255, 0.9), transparent 26%),
    linear-gradient(105deg, #ffffff 0%, #cfe5ff 48%, #fff8fe 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

body::before {
  inset: auto -7vw -16vh -6vw;
  height: 38vh;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(62, 126, 255, 0.24));
  filter: blur(1px);
}

body::after {
  top: 22px;
  right: 5vw;
  width: min(34vw, 440px);
  aspect-ratio: 1.7;
  border-radius: 44px;
  background:
    linear-gradient(120deg, rgba(255,255,255,0.7), rgba(105,151,255,0.18)),
    repeating-linear-gradient(110deg, transparent 0 28px, rgba(84, 132, 240, 0.1) 29px 54px);
  opacity: 0.6;
  transform: rotate(-6deg);
  filter: blur(0.5px);
}

button, input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 30px 0 42px;
}

.portal-view,
.quiz-view {
  display: none;
}

.portal-view.visible,
.quiz-view.visible {
  display: block;
}

.portal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 28px;
  align-items: end;
  min-height: 230px;
  padding: 36px 36px 28px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 34px;
  background:
    linear-gradient(120deg, rgba(255,255,255,0.92), rgba(238, 247, 255, 0.76)),
    radial-gradient(circle at 84% 28%, rgba(101,126,255,0.18), transparent 30%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.eyebrow,
.section-kicker,
.question-label,
.result-quote-label,
.result-section-label {
  margin: 0;
  color: var(--primary-deep);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.portal-hero h1,
.quiz-title-block h1 {
  margin: 8px 0 0;
  max-width: 760px;
  color: #2447ad;
  font-size: clamp(34px, 4.2vw, 50px);
  line-height: 1.06;
  letter-spacing: 0;
  text-shadow: 0 2px 0 rgba(255,255,255,0.88);
}

.intro,
#quizDescription {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.hero-avatar {
  width: 150px;
  height: 186px;
  justify-self: center;
  border-radius: 42% 42% 38% 38%;
  background:
    radial-gradient(circle at 50% 28%, #fff7f4 0 24%, transparent 25%),
    radial-gradient(circle at 50% 22%, #273252 0 34%, transparent 35%),
    linear-gradient(180deg, #ffffff 30%, #b9d9ff 31% 100%);
  box-shadow: 0 24px 45px rgba(49, 87, 218, 0.18);
  position: relative;
}

.hero-avatar::before {
  content: "";
  position: absolute;
  inset: 66px 42px auto;
  height: 56px;
  border-radius: 999px;
  background: linear-gradient(90deg, #4aa8ff, #66d984);
}

.portal-panel,
.quiz-topbar,
.quiz-stage {
  margin-top: 22px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.portal-panel {
  border-radius: 34px;
  padding: 28px;
}

.portal-panel-header,
.quiz-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.portal-panel h2 {
  margin: 6px 0 0;
  font-size: 28px;
  line-height: 1.2;
}

.ghost-button,
.back-button {
  border: 1px solid rgba(101, 126, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--primary-deep);
  font-weight: 800;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.ghost-button {
  padding: 10px 18px;
}

.back-button {
  flex: 0 0 auto;
  padding: 11px 18px;
}

.ghost-button:hover,
.back-button:hover,
.quiz-card-button:hover,
.option-button:hover {
  transform: translateY(-2px);
}

.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none;
}

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin-top: 24px;
}

.quiz-card {
  animation: card-enter 520ms cubic-bezier(.2,.8,.2,1) both;
  animation-delay: var(--delay);
}

.quiz-card-button {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 1px solid rgba(91, 137, 238, 0.28);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,250,255,0.96));
  box-shadow: var(--tight-shadow);
  overflow: hidden;
  text-align: left;
  color: inherit;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.quiz-card-button:hover {
  border-color: rgba(101, 126, 255, 0.62);
  box-shadow: 0 20px 54px rgba(49, 87, 218, 0.2);
}

.quiz-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center top;
  background: var(--soft);
}

.quiz-card-info {
  display: grid;
  gap: 8px;
  padding: 16px 18px 8px;
}

.quiz-card-title {
  color: #253d93;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.25;
}

.quiz-card-desc {
  min-height: 52px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.quiz-card-meta {
  color: #6b85d9;
  font-size: 12px;
  font-weight: 800;
}

.quiz-card-cta {
  display: block;
  margin: 12px 18px 18px;
  padding: 12px 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #4d6fff);
  color: #fff;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 12px 22px rgba(49, 87, 218, 0.22);
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quiz-topbar {
  border-radius: 30px;
  padding: 22px 24px;
}

.quiz-title-block {
  min-width: 0;
  flex: 1;
}

.quiz-title-block h1 {
  font-size: clamp(28px, 4vw, 44px);
}

.quiz-stage {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 20px;
  min-height: 680px;
  border-radius: 34px;
  padding: 20px;
}

.quiz-view.showing-result .quiz-stage {
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
}

.question-panel,
.answer-panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel-strong);
}

.question-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
  background:
    radial-gradient(circle at 72% 8%, rgba(255, 230, 140, 0.42), transparent 22%),
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(239,247,255,0.94));
}

.answer-panel {
  padding: 22px;
  overflow: auto;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-weight: 900;
}

.progress-track {
  height: 16px;
  margin-top: 12px;
  border-radius: 999px;
  background: #aebcff;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  background: linear-gradient(90deg, #6a68f3, #657eff);
  transition: width 260ms ease;
}

.progress-caption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.conversation {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

.bubble {
  max-width: 100%;
  padding: 16px 18px;
  border: 1px solid rgba(101,126,255,0.16);
  border-radius: 18px;
  background: rgba(255,255,255,0.86);
  color: var(--ink);
  line-height: 1.7;
  box-shadow: 0 10px 24px rgba(55, 93, 170, 0.08);
}

.bubble.current-question {
  border-color: rgba(49, 87, 218, 0.28);
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  box-shadow: 0 18px 36px rgba(49, 87, 218, 0.22);
}

.bubble.past-question {
  border-color: rgba(101, 126, 255, 0.12);
  background: rgba(255,255,255,0.72);
  color: #53617f;
  box-shadow: 0 8px 18px rgba(55, 93, 170, 0.06);
}

.bubble.user,
.bubble.past-answer {
  align-self: flex-end;
}

.bubble.past-answer {
  max-width: 92%;
  border-color: rgba(141, 151, 174, 0.18);
  background: #eef2f7;
  color: #46516a;
  box-shadow: none;
}

.bubble.pending {
  align-self: flex-start;
  width: 132px;
  border-color: rgba(101, 126, 255, 0.14);
  background: rgba(255,255,255,0.86);
}

.meta {
  margin-bottom: 8px;
  color: var(--primary-deep);
  font-size: 12px;
  font-weight: 800;
}

.bubble.current-question .meta {
  color: rgba(255,255,255,0.82);
}

.question-card,
.result-card {
  display: none;
}

.question-card.visible,
.result-card.visible {
  display: block;
}

.question-label {
  position: relative;
  margin-bottom: 18px;
  padding-left: 14px;
}

.question-label::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 5px;
  height: 16px;
  border-radius: 999px;
  background: #6997ff;
}

.options-list {
  display: grid;
  gap: 16px;
}

.option-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  gap: 16px;
  align-items: center;
  min-height: 86px;
  padding: 20px;
  border: 1px solid rgba(255,255,255,0.98);
  border-radius: 12px;
  background: #fff;
  color: #30384f;
  text-align: left;
  font-weight: 700;
  line-height: 1.7;
  box-shadow: 0 10px 22px rgba(55, 93, 170, 0.08);
  transition: transform 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.option-button:hover,
.option-button:focus-visible {
  border-color: #6a68f3;
  color: #5a5be6;
  box-shadow: 0 16px 32px rgba(90, 91, 230, 0.16);
  outline: none;
}

.option-check {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid #b9c1d6;
}

.option-button:hover .option-check,
.option-button:focus-visible .option-check {
  border: none;
  background:
    radial-gradient(circle at center, #fff 0 28%, transparent 30%),
    linear-gradient(135deg, #6a68f3, #657eff);
}

.wavy-dots {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}

.wavy-dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
  animation: wavy-dot 900ms ease-in-out infinite;
}

.wavy-dots span:nth-child(2) { animation-delay: 120ms; }
.wavy-dots span:nth-child(3) { animation-delay: 240ms; }

@keyframes wavy-dot {
  0%, 100% { transform: translateY(0); opacity: 0.45; }
  50% { transform: translateY(-5px); opacity: 1; }
}

.result-card {
  color: var(--ink);
}

.result-hero {
  display: grid;
  grid-template-columns: minmax(440px, 0.95fr) minmax(240px, 0.75fr);
  gap: clamp(20px, 3vw, 32px);
  align-items: center;
  margin-bottom: 20px;
}

.result-poster-block {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.result-poster {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  min-height: 520px;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 18px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 26% 22%, rgba(255, 255, 255, 0.9), transparent 24%),
    radial-gradient(circle at 78% 18%, rgba(255, 230, 140, 0.54), transparent 18%),
    linear-gradient(155deg, #dcecff, #9ac5ff 58%, #657eff);
  box-shadow: 0 22px 50px rgba(49, 87, 218, 0.18);
}

.result-quiz-social-energy-ti .result-poster {
  background:
    radial-gradient(circle at 24% 20%, rgba(255, 255, 255, 0.9), transparent 24%),
    radial-gradient(circle at 80% 18%, rgba(255, 230, 140, 0.42), transparent 18%),
    linear-gradient(155deg, #d9fff0, #a9efcd 48%, #69c894);
}

.result-quiz-love-communication-theater .result-poster {
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.9), transparent 24%),
    radial-gradient(circle at 80% 18%, rgba(255, 230, 140, 0.34), transparent 18%),
    linear-gradient(155deg, #ffe1ee, #ffc0d4 48%, #ff8ab1);
}

.result-quiz-rumination-processor .result-poster {
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.9), transparent 24%),
    radial-gradient(circle at 80% 18%, rgba(137, 216, 255, 0.38), transparent 18%),
    linear-gradient(155deg, #e6ebff, #c7d2ff 48%, #8ea2ff);
}

.result-quiz-emotional-weather .result-poster {
  background:
    radial-gradient(circle at 24% 20%, rgba(255, 255, 255, 0.9), transparent 24%),
    radial-gradient(circle at 80% 18%, rgba(137, 216, 255, 0.42), transparent 18%),
    linear-gradient(155deg, #dff0ff, #b6d8ff 48%, #74a9ff);
}

.result-quiz-friends-see-you .result-poster {
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.9), transparent 24%),
    radial-gradient(circle at 80% 20%, rgba(255, 230, 140, 0.4), transparent 18%),
    linear-gradient(155deg, #fff0cf, #ffd68a 48%, #ffab58);
}

.result-pill {
  position: relative;
  z-index: 3;
  display: inline-flex;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--primary-deep);
  box-shadow: 0 10px 24px rgba(49, 87, 218, 0.08);
  font-weight: 800;
}

.result-poster-image {
  position: absolute;
  inset: 62px 14px 14px;
  width: calc(100% - 28px);
  height: calc(100% - 76px);
  object-fit: contain;
  object-position: center bottom;
  border-radius: 24px;
  box-shadow: 0 18px 36px rgba(38, 54, 95, 0.18);
}

.result-poster-image-generated {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 28px;
  box-shadow: none;
}

.result-poster-generated .result-pill,
.result-poster-generated .result-sticker {
  display: none;
}

.result-save-button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(101, 126, 255, 0.18);
  border-radius: 999px;
  background: #243d93;
  color: #fff;
  box-shadow: 0 12px 24px rgba(36, 61, 147, 0.18);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
}

.result-save-button:hover {
  transform: translateY(-1px);
}

.result-save-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.result-sticker {
  position: absolute;
  border-radius: 999px;
  opacity: 0.92;
}

.sticker-a {
  top: 62px;
  right: 26px;
  width: 84px;
  height: 84px;
  background: rgba(255, 255, 255, 0.24);
  transform: rotate(-12deg);
}

.sticker-b {
  left: 28px;
  bottom: 72px;
  width: 56px;
  height: 18px;
  background: rgba(255, 255, 255, 0.4);
  transform: rotate(-18deg);
}

.result-kicker {
  align-self: flex-start;
  margin-bottom: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(101, 126, 255, 0.12);
  color: var(--primary-deep);
  font-size: 12px;
  font-weight: 900;
}

.result-role {
  margin-bottom: 12px;
  color: #243d93;
  font-size: clamp(38px, 5vw, 68px);
  font-weight: 900;
  line-height: 1.05;
  text-shadow: 0 2px 0 rgba(255,255,255,0.86);
}

.result-hero-copy h3 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(22px, 2.6vw, 32px);
  line-height: 1.35;
}

.result-hero-copy {
  display: grid;
  align-content: start;
  gap: 16px;
}

.result-quote {
  color: #607097;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.65;
}

.result-tagline,
.result-line {
  line-height: 1.75;
}

.result-tagline {
  margin: 0;
  color: var(--primary-deep);
  font-size: 18px;
  font-weight: 900;
}

.result-action-card {
  border: 1px solid rgba(101, 126, 255, 0.12);
  border-radius: 18px;
  background: rgba(255,255,255,0.78);
  box-shadow: 0 12px 26px rgba(55, 93, 170, 0.07);
}

.result-section-label {
  margin-bottom: 10px;
}

.result-accordion {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.result-line + .result-line {
  margin-top: 8px;
}

.result-accordion-item {
  border: 1px solid rgba(101, 126, 255, 0.14);
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  box-shadow: 0 10px 22px rgba(55, 93, 170, 0.06);
  overflow: hidden;
}

.result-accordion-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  padding: 0 18px;
  color: var(--primary-deep);
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.result-accordion-item summary::-webkit-details-marker {
  display: none;
}

.result-accordion-item summary::after {
  content: "+";
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(101, 126, 255, 0.12);
  color: var(--primary-deep);
  line-height: 24px;
  text-align: center;
}

.result-accordion-item[open] summary::after {
  content: "-";
}

.result-accordion-body {
  padding: 0 18px 18px;
  color: var(--muted);
}

.result-action-card {
  padding: 18px 18px 20px;
}

.result-action-primary {
  border-color: rgba(101, 126, 255, 0.22);
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(219, 231, 255, 0.78));
}

.result-quick-move {
  color: var(--ink);
  font-size: 19px;
  font-weight: 900;
  line-height: 1.6;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px dashed rgba(101, 126, 255, 0.28);
  border-radius: 22px;
  background: rgba(255,255,255,0.68);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .portal-hero,
  .quiz-stage,
  .quiz-view.showing-result .quiz-stage,
  .result-hero {
    grid-template-columns: 1fr;
  }

  .hero-avatar {
    display: none;
  }

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

  .quiz-topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .result-poster {
    width: min(100%, 560px);
  }

}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 24px, 1180px);
    padding: 16px 0 28px;
  }

  .portal-hero,
  .portal-panel,
  .quiz-topbar,
  .quiz-stage {
    border-radius: 24px;
  }

  .portal-hero {
    min-height: auto;
    padding: 26px 22px;
  }

  .portal-panel,
  .quiz-stage {
    padding: 14px;
  }

  .quiz-stage {
    gap: 14px;
    min-height: auto;
  }

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

  .quiz-card-desc {
    min-height: auto;
  }

  .quiz-topbar {
    padding: 18px;
  }

  .question-panel,
  .answer-panel {
    padding: 16px;
    border-radius: 22px;
  }

  .question-panel {
    gap: 12px;
    grid-template-rows: auto auto;
  }

  .conversation {
    gap: 0;
    padding-right: 0;
    overflow: visible;
  }

  .conversation .bubble.past-question,
  .conversation .bubble.past-answer {
    display: none;
  }

  .result-poster {
    min-height: 360px;
    width: min(100%, 390px);
    border-radius: 22px;
  }

  .result-poster-image {
    inset: 58px 10px 10px;
    width: calc(100% - 20px);
    height: calc(100% - 68px);
    border-radius: 18px;
  }

  .result-poster-image-generated {
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 22px;
  }

  .result-role {
    font-size: 34px;
  }

  .result-hero-copy h3 {
    font-size: 22px;
  }

  .result-quick-move {
    font-size: 17px;
  }
}
