:root {
  color-scheme: light;
  --ink: #162033;
  --muted: #667085;
  --line: #d7dce5;
  --paper: #fbfcff;
  --card: #ffffff;
  --blue: #3566d6;
  --green: #18966b;
  --gold: #c88721;
  --red: #d9514e;
  --shadow: 0 22px 70px rgba(25, 38, 68, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background:
    linear-gradient(135deg, rgba(53, 102, 214, 0.12), transparent 35%),
    linear-gradient(315deg, rgba(24, 150, 107, 0.12), transparent 32%),
    #f3f6fb;
}

button,
input {
  font: inherit;
}

.app {
  width: min(100%, 980px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 18px;
}

.shell {
  display: grid;
  gap: 18px;
}

.panel {
  overflow: hidden;
  border: 1px solid rgba(215, 220, 229, 0.9);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  place-items: center;
  min-height: 560px;
  padding: 28px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 48px 46px;
  text-align: center;
}

.eyebrow {
  width: fit-content;
  border: 1px solid rgba(53, 102, 214, 0.22);
  border-radius: 999px;
  padding: 9px 16px;
  color: #274a9f;
  background: rgba(53, 102, 214, 0.08);
  font-size: 14px;
  font-weight: 850;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 620px;
  font-size: clamp(38px, 6vw, 66px);
  line-height: 1.08;
  letter-spacing: 0;
}

.subtitle {
  max-width: 610px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.75;
}

.meta-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 560px);
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 12px;
  color: #354058;
  background: #fff;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.primary-btn,
.ghost-btn {
  border: 0;
  border-radius: 999px;
  min-height: 50px;
  padding: 0 22px;
  cursor: pointer;
  font-weight: 800;
}

.primary-btn {
  color: #fff;
  background: #162033;
  box-shadow: 0 12px 28px rgba(22, 32, 51, 0.22);
}

.primary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.ghost-btn {
  color: #1f2a44;
  background: #eef2f8;
}

.character {
  position: relative;
  display: grid;
  place-items: center;
  width: min(320px, 74vw);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 34px;
  background:
    radial-gradient(circle at 50% 25%, rgba(255, 255, 255, 0.9), transparent 30%),
    linear-gradient(145deg, var(--tone-a), var(--tone-b));
  box-shadow: 0 28px 60px rgba(51, 72, 112, 0.22);
}

.character::before {
  content: "";
  position: absolute;
  width: 112px;
  height: 112px;
  top: 62px;
  border: 8px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: #ffe3c7;
  box-shadow: inset 0 -16px rgba(207, 132, 93, 0.14);
}

.character::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 126px;
  top: 182px;
  border-radius: 52px 52px 28px 28px;
  background: rgba(22, 32, 51, 0.88);
  box-shadow: inset 0 18px rgba(255, 255, 255, 0.08);
}

.character-mark {
  position: relative;
  z-index: 1;
  margin-top: 184px;
  border-radius: 18px;
  padding: 10px 14px;
  color: #162033;
  background: rgba(255, 255, 255, 0.88);
  font-size: 34px;
  font-weight: 900;
}

.character-with-image {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.78), transparent 38%),
    linear-gradient(145deg, color-mix(in srgb, var(--tone-a) 86%, white), color-mix(in srgb, var(--tone-b) 72%, white));
}

.character-with-image::before,
.character-with-image::after {
  display: none;
}

.character-image {
  position: relative;
  z-index: 1;
  width: 86%;
  height: 86%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 20px 22px rgba(35, 52, 82, 0.16));
}

.tiny-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.stats-setting {
  display: grid;
  gap: 8px;
  width: min(100%, 560px);
  border: 1px solid rgba(215, 220, 229, 0.9);
  border-radius: 18px;
  padding: 16px 18px;
  background: #f8fafc;
  text-align: left;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  cursor: pointer;
  color: #354058;
  font-weight: 700;
}

.toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--blue);
}

.start-action {
  display: grid;
  justify-items: center;
  width: min(100%, 560px);
}

.start-action .primary-btn {
  width: min(100%, 360px);
}

.quiz-card {
  padding: 26px;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr);
  align-items: start;
  gap: 18px;
  margin-bottom: 24px;
}

.brand {
  padding-top: 2px;
  font-weight: 900;
}

.quiz-progress {
  display: grid;
  gap: 9px;
}

.quiz-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-wrap {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe5ef;
}

.progress {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 0.25s ease;
}

.question-box {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}

.question-index {
  color: #1f2a44;
  font-size: 14px;
  font-weight: 800;
}

.progress-percent {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.question-title {
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.18;
}

.question-prompt {
  color: #3e4b63;
  font-size: 18px;
  line-height: 1.8;
}

.options {
  display: grid;
  gap: 12px;
}

.option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  color: var(--ink);
  background: #fff;
  text-align: left;
  transition: transform 0.18s ease, border 0.18s ease, background 0.18s ease;
}

.option:hover {
  transform: translateY(-1px);
  border-color: rgba(53, 102, 214, 0.55);
}

.option.selected {
  border-color: var(--blue);
  background: #eef4ff;
}

.option-letter {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  background: #162033;
  font-weight: 900;
}

.nav-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.loading-page {
  display: grid;
  place-items: center;
  min-height: 620px;
  padding: 36px;
  text-align: center;
}

.letter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 26px auto 0;
  max-width: 420px;
}

.letter-tile {
  border-radius: 18px;
  padding: 18px 8px;
  color: #fff;
  background: #162033;
  font-size: 26px;
  font-weight: 900;
  animation: pulse 1.4s infinite ease-in-out;
}

.letter-tile:nth-child(2) { animation-delay: 0.15s; }
.letter-tile:nth-child(3) { animation-delay: 0.3s; }
.letter-tile:nth-child(4) { animation-delay: 0.45s; }

@keyframes pulse {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(-4px); opacity: 1; }
}

.result-layout {
  display: grid;
  gap: 18px;
}

.result-hero-card {
  display: grid;
  gap: 18px;
  padding: 34px 32px 30px;
  border: 1px solid rgba(222, 228, 238, 0.9);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.88)),
    radial-gradient(circle at 12% 12%, rgba(53, 102, 214, 0.1), transparent 30%);
}

.result-kicker {
  justify-self: center;
  width: 100%;
  border: 1px solid rgba(53, 102, 214, 0.22);
  border-radius: 18px;
  padding: 12px 16px;
  color: #274a9f;
  background: rgba(53, 102, 214, 0.08);
  font-size: 14px;
  font-weight: 850;
  text-align: center;
}

.result-hero-main {
  display: grid;
  gap: 20px;
  justify-items: center;
}

.persona-art-card {
  display: grid;
  place-items: center;
  width: 100%;
  height: 360px;
  overflow: hidden;
  border: 1px solid rgba(53, 102, 214, 0.22);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.82), transparent 38%),
    linear-gradient(145deg, #e7f0ff, #f4e7cf);
}

.persona-art-card .character {
  width: min(520px, 96vw);
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.persona-art-card .character-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.persona-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  margin-top: 6px;
  text-align: center;
}

.identity-row {
  display: grid;
  justify-items: center;
}

.code,
.code-title {
  color: var(--ink);
  font-size: clamp(25px, 4.4vw, 34px);
  line-height: 1.15;
  font-weight: 950;
}

.nickname {
  padding-bottom: 0;
  font-size: 29px;
  font-weight: 950;
}

.official-name {
  width: fit-content;
  margin-top: 10px;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: #f5f7fb;
  font-size: 17px;
  font-weight: 850;
}

.persona-tagline {
  margin-top: 16px;
  border: 1px solid rgba(53, 102, 214, 0.1);
  border-radius: 16px;
  padding: 12px 18px;
  color: #2f3b52;
  background: linear-gradient(135deg, rgba(53, 102, 214, 0.08), rgba(53, 102, 214, 0.02));
  font-size: 18px;
  font-weight: 850;
  line-height: 1.6;
}

.stat {
  width: fit-content;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  color: #354058;
  background: #f8fafc;
  font-size: 14px;
  font-weight: 800;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr;
  justify-content: center;
  gap: 12px;
  justify-self: center;
  width: 100%;
}

.result-actions .primary-btn,
.result-actions .ghost-btn {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.result-main {
  display: grid;
  gap: 18px;
  padding: 0 0 8px;
}

.section-label {
  margin-bottom: 12px;
  color: #162033;
  font-size: 20px;
  font-weight: 950;
}

.dimension-list {
  display: grid;
  gap: 14px;
}

.dimension-row {
  display: grid;
  gap: 7px;
}

.dimension-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 900;
}

.dimension-names {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.bar {
  display: grid;
  grid-template-columns: var(--left) var(--right);
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9edf4;
}

.bar-left {
  background: var(--blue);
}

.bar-right {
  background: var(--gold);
}

.feature {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  background: #fff;
}

.feature p {
  color: #3e4b63;
  font-size: 17px;
  line-height: 1.85;
}

.dimension-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  background: #fbfcfe;
}

.disclaimer {
  grid-column: 1 / -1;
  margin-top: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(22, 32, 51, 0.52);
  backdrop-filter: blur(6px);
}

.modal-panel {
  width: min(100%, 460px);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  padding: 28px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(22, 32, 51, 0.3);
}

.modal-panel h2 {
  margin-bottom: 14px;
  font-size: 28px;
  line-height: 1.2;
}

.modal-panel p {
  margin-bottom: 14px;
  color: #3e4b63;
  font-size: 16px;
  line-height: 1.75;
}

.modal-panel .primary-btn {
  width: 100%;
  margin-top: 6px;
}

.share-modal-panel {
  width: min(100%, 460px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 14px;
}

.share-poster {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 12px;
  width: min(100%, 360px);
  margin: 0 auto 12px;
  border: 1px solid rgba(215, 220, 229, 0.9);
  border-radius: 26px;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 18%, rgba(53, 102, 214, 0.14), transparent 30%),
    linear-gradient(160deg, #f9fbff 0%, #ffffff 48%, #f6f8fc 100%);
  text-align: center;
}

.share-poster-topline {
  width: 100%;
  color: #274a9f;
  font-size: 13px;
  font-weight: 900;
  text-align: left;
}

.share-poster-hero {
  display: grid;
  place-items: center;
  width: 100%;
  height: 180px;
  overflow: hidden;
  border-radius: 22px;
  background: linear-gradient(145deg, #e7f0ff, #f4e7cf);
}

.share-poster-art {
  display: grid;
  place-items: center;
  width: 100%;
  height: 180px;
  overflow: hidden;
}

.share-poster-image {
  display: block;
  width: 180px !important;
  height: 180px !important;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
}

.share-poster-identity {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.share-poster-code {
  color: var(--ink);
  font-size: 46px;
  line-height: 1;
  font-weight: 950;
}

.share-poster-name {
  color: var(--ink);
  font-size: 22px;
  font-weight: 950;
}

.share-poster-official {
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted);
  background: #f1f4f9;
  font-size: 13px;
  font-weight: 850;
}

.share-poster-feature {
  width: 100%;
  margin: 0;
  border-left: 3px solid rgba(53, 102, 214, 0.8);
  border-radius: 12px;
  padding: 9px 12px;
  color: #2f3b52;
  background: rgba(53, 102, 214, 0.06);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.55;
  text-align: left;
}

.share-poster-feature span {
  display: block;
  margin-bottom: 4px;
  color: #274a9f;
  font-size: 11px;
  font-weight: 900;
}

.share-poster-feature p {
  margin: 0;
}

.qr-placeholder {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: auto;
  border-top: 1px solid rgba(215, 220, 229, 0.9);
  padding-top: 12px;
  color: #354058;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.qr-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.qr-placeholder strong,
.qr-placeholder span {
  display: block;
}

.qr-placeholder span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.qr-box {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid #cfd6e2;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.qr-svg {
  display: block;
  width: 48px;
  height: 48px;
}

.share-poster-risk {
  width: 100%;
  color: #98a2b3;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.4;
  text-align: center;
}

.share-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.share-modal-actions .primary-btn,
.share-modal-actions .ghost-btn {
  width: 100%;
  margin-top: 0;
}

@media (max-width: 760px) {
  .app {
    padding: 14px;
  }

  .result-layout {
    grid-template-columns: 1fr;
  }

  .result-hero-card {
    padding: 24px 18px;
  }

  .result-hero-main {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .persona-art-card {
    height: 300px;
  }

  .persona-art-card .character {
    width: min(420px, 96vw);
    height: 100%;
  }

  .result-main {
    padding: 18px;
  }

  .code-title {
    font-size: clamp(24px, 6vw, 31px);
  }

  .nickname {
    padding-bottom: 0;
    font-size: 26px;
  }

  .persona-tagline {
    font-size: 18px;
  }

  .hero {
    min-height: auto;
    padding: 18px;
  }

  .hero-copy {
    gap: 18px;
    padding: 30px 22px;
  }

  .meta-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .stats-setting,
  .start-action {
    width: 100%;
  }

  .topbar {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .quiz-progress-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .nav-row {
    flex-direction: column-reverse;
  }

  .result-actions {
    width: 100%;
  }

  .primary-btn,
  .ghost-btn {
    width: 100%;
  }

  .result-actions .primary-btn,
  .result-actions .ghost-btn {
    width: 100%;
  }

  .modal-panel {
    padding: 24px 20px;
  }

  .share-modal-panel {
    padding: 12px;
  }

  .share-poster {
    width: min(100%, 318px);
    padding: 18px;
  }

  .share-poster-hero,
  .share-poster-art {
    height: 156px;
  }

  .share-poster-image {
    width: 156px !important;
    height: 156px !important;
  }

  .share-poster-code {
    font-size: 39px;
  }

  .share-poster-name {
    font-size: 20px;
  }
}
