:root {
  color-scheme: dark;
  --bg: #151314;
  --surface: #211e1f;
  --surface-strong: #292526;
  --text: #f8f2ef;
  --text-soft: #b9afac;
  --line: #443d3d;
  --accent: #ef5b56;
  --accent-deep: #b52d32;
  --success: #77c7a8;
  --danger: #ff8a8d;
  --radius: 24px;
  --radius-small: 15px;
  --shadow: 0 28px 90px rgba(5, 4, 4, 0.38);
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(239, 91, 86, 0.13), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

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

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(239, 91, 86, 0.55);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: var(--radius-small);
  background: var(--text);
  color: var(--bg);
}

.skip-link:focus {
  top: 16px;
}

.star-screen {
  display: none;
  width: min(1240px, calc(100% - 48px));
  min-height: calc(100dvh - 72px);
  margin: 0 auto;
}

.star-screen.is-active {
  display: block;
  animation: screen-enter 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.star-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.star-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.star-brand > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: var(--text);
  font-weight: 900;
  transform: rotate(-5deg);
}

.star-brand b {
  font-size: 16px;
}

.independent-test {
  color: var(--text-soft);
  font-size: 12px;
}

.landing-grid {
  min-height: calc(100dvh - 144px);
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(480px, 1.12fr);
  align-items: center;
  gap: clamp(44px, 7vw, 100px);
  padding: 28px 0 62px;
}

.landing-copy {
  position: relative;
  z-index: 1;
}

.landing-kicker {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.landing-copy h1 {
  margin: 0;
  font-size: clamp(54px, 6.2vw, 88px);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.landing-copy h1 em {
  color: var(--accent);
  font-style: normal;
}

.landing-intro {
  max-width: 30em;
  margin: 25px 0 0;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.75;
}

.star-primary,
.star-secondary {
  min-height: 54px;
  border-radius: var(--radius-small);
  cursor: pointer;
  font-weight: 900;
  transition: transform 160ms ease, background-color 180ms ease, border-color 180ms ease;
}

.star-primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 19px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff8f5;
}

.landing-copy > .star-primary {
  max-width: 390px;
  margin-top: 30px;
}

.star-primary:hover:not(:disabled) {
  background: #d94745;
}

.star-primary:active,
.star-secondary:active {
  transform: scale(0.98);
}

.star-primary:disabled {
  border-color: var(--line);
  background: var(--line);
  color: var(--text-soft);
  cursor: not-allowed;
}

.star-secondary {
  width: 100%;
  padding: 0 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.star-text-button {
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 12px;
}

.landing-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 470px;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.landing-facts span {
  display: grid;
  gap: 5px;
  color: var(--text-soft);
  font-size: 10px;
}

.landing-facts strong {
  color: var(--text);
  font-size: 23px;
}

.hero-portrait {
  position: relative;
  height: min(74dvh, 790px);
  min-height: 560px;
  overflow: hidden;
  margin: 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 66%, rgba(17, 14, 15, 0.82));
  pointer-events: none;
}

.hero-portrait img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.hero-portrait figcaption {
  position: absolute;
  right: 20px;
  bottom: 18px;
  z-index: 1;
  color: rgba(248, 242, 239, 0.72);
  font-size: 10px;
}

.star-footer {
  width: min(1240px, calc(100% - 48px));
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 11px;
}

.star-footer a {
  color: var(--text-soft);
  text-decoration: none;
}

.star-footer button {
  padding: 0;
  border: 0;
  color: var(--text-soft);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.star-footer a:hover,
.star-footer button:hover {
  color: var(--text);
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 18px;
  color: var(--text-soft);
  font-size: 11px;
}

.trust-strip span {
  position: relative;
  padding-left: 12px;
}

.trust-strip span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--accent);
  transform: translateY(-50%);
}

.trust-strip button {
  padding: 5px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: var(--text);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.star-quiz,
.star-paywall,
.star-result {
  padding: 46px 0 78px;
}

.quiz-shell {
  width: min(790px, 100%);
  margin: 0 auto;
}

.quiz-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 22px;
}

.quiz-header .star-text-button {
  justify-self: start;
}

.quiz-header > strong {
  font-size: 14px;
}

.quiz-header > span {
  justify-self: end;
  color: var(--text-soft);
  font-size: 12px;
}

.quiz-progress {
  display: grid;
  grid-template-columns: repeat(var(--question-count, 10), 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.progress-segment {
  height: 5px;
  border-radius: 999px;
  background: var(--line);
}

.progress-segment.is-current {
  transform: scaleY(1.7);
  background: var(--accent);
}

.progress-segment.is-correct {
  background: var(--success);
}

.progress-segment.is-wrong {
  background: var(--danger);
}

.progress-segment.is-locked {
  opacity: 0.34;
}

.question-panel {
  min-height: 600px;
  padding: clamp(28px, 5vw, 52px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.question-meta {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 800;
}

.question-meta span:first-child {
  color: var(--accent);
}

#questionContext {
  margin: 38px 0 8px;
  color: var(--text-soft);
  font-size: 13px;
}

.question-panel h2 {
  margin: 0 0 30px;
  font-size: clamp(27px, 4vw, 40px);
  line-height: 1.3;
  letter-spacing: -0.04em;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.answer-button {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.answer-button:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.answer-button:disabled {
  cursor: default;
}

.answer-button.is-eliminated {
  opacity: 0.28;
  text-decoration: line-through;
}

.answer-key {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--bg);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 900;
}

.answer-button.is-correct {
  border-color: var(--success);
  background: rgba(119, 199, 168, 0.14);
}

.answer-button.is-wrong {
  border-color: var(--danger);
  background: rgba(255, 138, 141, 0.13);
}

.answer-feedback {
  min-height: 44px;
  margin: 18px 0 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.6;
}

.answer-feedback strong {
  color: var(--text);
}

.hint-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}

.hint-button,
.sort-reset {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.hint-button:hover:not(:disabled),
.sort-reset:hover:not(:disabled) {
  border-color: var(--accent);
}

.hint-button:disabled,
.sort-reset:disabled {
  opacity: 0.38;
  cursor: default;
}

.hint-tools > span {
  margin-left: auto;
  color: var(--text-soft);
  font-size: 11px;
}

.hint-feedback {
  min-height: 20px;
  margin: 9px 0 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.55;
}

.answers.is-sorting {
  grid-template-columns: 1fr;
}

.sort-button {
  min-height: 58px;
}

.sort-button.is-ordered {
  border-color: var(--accent);
  background: rgba(239, 91, 86, 0.1);
}

.sort-button.is-ordered .answer-key {
  background: var(--accent);
  color: #fff8f5;
}

.sort-reset {
  justify-self: start;
}

.next-button {
  margin-top: 12px;
}

.paywall-grid,
.result-grid {
  width: min(1000px, 100%);
  min-height: calc(100dvh - 196px);
  display: grid;
  grid-template-columns: minmax(340px, 0.86fr) minmax(0, 1.14fr);
  align-items: center;
  gap: clamp(42px, 8vw, 90px);
  margin: 0 auto;
}

.teaser-card {
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(30px, 5vw, 48px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 78% 22%, rgba(239, 91, 86, 0.3), transparent 14rem),
    var(--surface);
  box-shadow: var(--shadow);
}

.teaser-name {
  color: var(--text-soft);
  font-size: 12px;
}

.teaser-level {
  margin-top: 46px;
  color: var(--accent);
  font-size: clamp(72px, 10vw, 132px);
  line-height: 0.9;
  letter-spacing: -0.1em;
}

.teaser-unit {
  margin-top: 22px;
  font-size: 40px;
  font-weight: 900;
}

.teaser-card p {
  margin: 20px 0 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.locked-level {
  margin-top: 36px;
  padding: 18px;
  border: 1px dashed var(--accent);
  border-radius: var(--radius-small);
  color: var(--text-soft);
  font-size: 12px;
}

.paywall-copy h2,
.result-copy h2 {
  margin: 0;
  font-size: clamp(40px, 5.5vw, 64px);
  line-height: 1.06;
  letter-spacing: -0.06em;
}

.paywall-copy > p:not(.landing-kicker),
.result-copy > p:not(.landing-kicker, .result-status) {
  max-width: 36em;
  margin: 20px 0 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.75;
}

.result-identity {
  margin-top: 24px;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.result-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--line);
}

.result-meta-grid > span {
  min-width: 0;
  padding: 14px;
  background: var(--surface);
}

.result-meta-grid small,
.result-meta-grid strong {
  display: block;
}

.result-meta-grid small {
  color: var(--text-soft);
  font-size: 10px;
}

.result-meta-grid strong {
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.result-rank {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-top: 22px;
}

.result-rank strong {
  color: var(--accent);
  font-size: 34px;
}

.result-rank span {
  color: var(--accent);
  font-size: 20px;
  letter-spacing: 0.12em;
  animation: stars-arrive 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.result-promotion,
.result-attempts {
  margin-top: 8px !important;
  font-size: 12px !important;
}

.result-promotion {
  color: var(--text) !important;
  font-weight: 800;
}

.result-attempts {
  color: var(--text-soft) !important;
}

.ability-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.ability-tags span {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 800;
}

.purchase-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 28px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.purchase-line strong {
  color: var(--accent);
  font-size: 28px;
}

.paywall-copy > .star-primary {
  margin-top: 22px;
}

.leave-paywall,
.retry-button {
  width: 100%;
  margin-top: 10px;
  text-align: center;
}

.paywall-copy small {
  display: block;
  margin-top: 5px;
  color: var(--text-soft);
  font-size: 10px;
  text-align: center;
}

.poster-panel {
  margin: 0;
}

.poster-panel img {
  width: min(100%, 520px);
  aspect-ratio: 3 / 4;
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  object-fit: cover;
}

.poster-style-picker {
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.poster-style-button {
  min-height: 66px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, border-color 180ms ease, background-color 180ms ease;
}

.poster-style-button:hover {
  border-color: var(--accent);
}

.poster-style-button:active {
  transform: scale(0.98);
}

.poster-style-button.is-selected {
  border-color: var(--accent);
  background: rgba(239, 91, 86, 0.12);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.poster-style-button strong {
  font-size: 12px;
}

.poster-style-button span {
  color: var(--text-soft);
  font-size: 9px;
}

.poster-panel p {
  width: min(100%, 520px);
  margin: 12px 0 0;
  color: var(--text-soft);
  font-size: 10px;
  text-align: center;
}

.result-copy .star-primary {
  justify-content: center;
  margin-top: 28px;
}

.result-copy .star-secondary {
  margin-top: 12px;
}

.result-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 11px;
  text-align: center;
}

.star-dialog[hidden] {
  display: none;
}

.star-dialog {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
}

.dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 9, 0.76);
  backdrop-filter: blur(10px);
}

.dialog-card {
  position: relative;
  width: min(480px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dialog-card h2 {
  margin: 18px 0 0;
  font-size: 26px;
}

.dialog-card p {
  margin: 12px 0 24px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.7;
}

.dialog-card-scroll {
  max-height: min(760px, calc(100dvh - 40px));
  overflow-y: auto;
}

.dialog-eyebrow {
  margin: 0 0 6px !important;
  color: var(--accent) !important;
  font-size: 10px !important;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.source-list {
  display: grid;
  gap: 10px;
  margin: 0 0 24px;
  padding-left: 24px;
}

.source-list li {
  padding-left: 4px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
}

.source-list strong,
.source-list a {
  color: var(--text);
}

.source-list a {
  margin-left: 8px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dialog-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-soft);
  font-size: 12px;
}

.dialog-price strong {
  color: var(--accent);
  font-size: 28px;
}

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

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

.dialog-confirm {
  justify-content: center;
}

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

@keyframes stars-arrive {
  from { opacity: 0; transform: translateY(8px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 900px) {
  .landing-grid,
  .paywall-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .landing-grid {
    padding-top: 12px;
  }

  .hero-portrait {
    order: -1;
    height: 46dvh;
    min-height: 330px;
  }

  .landing-copy {
    padding-bottom: 48px;
  }

  .teaser-card,
  .poster-panel img,
  .poster-style-picker {
    width: min(520px, 100%);
    margin: 0 auto;
  }

  .poster-style-picker {
    margin-top: 14px;
  }

  .poster-panel p {
    margin-right: auto;
    margin-left: auto;
  }
}

@media (max-width: 620px) {
  .star-screen,
  .star-footer {
    width: min(100% - 32px, 1240px);
  }

  .star-header {
    min-height: 64px;
  }

  .independent-test {
    display: none;
  }

  .landing-grid {
    min-height: calc(100dvh - 64px);
    gap: 28px;
    padding-bottom: 44px;
  }

  .hero-portrait {
    height: 40dvh;
    min-height: 300px;
  }

  .landing-copy h1 {
    font-size: clamp(49px, 15vw, 66px);
  }

  .landing-intro {
    margin-top: 18px;
  }

  .landing-copy > .star-primary {
    max-width: none;
    margin-top: 22px;
  }

  .landing-facts {
    margin-top: 28px;
  }

  .star-footer {
    min-height: 0;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 22px 0;
    text-align: center;
  }

  .star-quiz,
  .star-paywall,
  .star-result {
    padding: 24px 0 56px;
  }

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

  .quiz-header > strong {
    display: none;
  }

  .question-panel {
    min-height: 640px;
    padding: 24px 20px;
  }

  #questionContext {
    margin-top: 28px;
  }

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

  .answer-button {
    min-height: 58px;
  }

  .paywall-grid,
  .result-grid {
    min-height: auto;
    gap: 34px;
  }

  .teaser-card {
    min-height: 500px;
    padding: 28px 24px;
  }

  .teaser-level {
    font-size: 88px;
  }

  .dialog-actions {
    grid-template-columns: 1fr;
  }

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

  .poster-style-picker {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .poster-style-button {
    min-height: 62px;
    padding: 9px;
  }
}

@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;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .dialog-backdrop {
    backdrop-filter: none;
  }
}
