:root {
  color-scheme: dark;
  --bg: #11100f;
  --surface: #191918;
  --surface-2: #222120;
  --ink: #f2efe9;
  --muted: #b7b0a8;
  --line: rgba(242, 239, 233, 0.14);
  --red: #e55a5f;
  --teal: #50c5b7;
  --gold: #e7b65b;
  --blue: #6aa3ff;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  background:
    radial-gradient(circle at 20% 0%, rgba(80, 197, 183, 0.14), transparent 26rem),
    radial-gradient(circle at 88% 12%, rgba(229, 90, 95, 0.12), transparent 24rem),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

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

.app {
  min-height: 100svh;
  overflow: hidden;
}

.page {
  min-height: 100svh;
  width: min(100%, 1220px);
  margin: 0 auto;
  padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
}

.page[hidden] {
  display: none;
}

.page--start {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 54px;
  padding-bottom: 28px;
}

.hero__media {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(229, 90, 95, 0.24), transparent 32%),
    radial-gradient(circle at 82% 16%, rgba(80, 197, 183, 0.2), transparent 34%),
    linear-gradient(135deg, #161514 0%, #11100f 45%, #1f1718 100%);
}

.hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(17, 16, 15, 0.28), rgba(17, 16, 15, 0.86));
}

#heroCanvas {
  position: absolute;
  right: -16vw;
  bottom: 4vh;
  width: min(96vw, 720px);
  height: min(96vw, 720px);
  opacity: 0.62;
}

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(242, 239, 233, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 239, 233, 0.055) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 84%);
}

.mesh {
  position: absolute;
  width: 42vmax;
  aspect-ratio: 1;
  border: 1px solid rgba(242, 239, 233, 0.16);
  transform: rotate(18deg);
}

.mesh-a {
  left: -18vmax;
  top: 8vmax;
}

.mesh-b {
  right: 4vmax;
  bottom: -16vmax;
  border-color: rgba(80, 197, 183, 0.2);
}

.hero__content,
.notice {
  position: relative;
  z-index: 1;
}

.hero__content {
  width: min(720px, 100%);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(3.05rem, 15vw, 8rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.lead {
  max-width: 660px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 1rem;
}

.hero__actions,
.results__header,
.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.button,
.icon-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(242, 239, 233, 0.06);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.button {
  padding: 0 18px;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(242, 239, 233, 0.34);
}

.button--primary {
  background: var(--red);
  border-color: var(--red);
  color: #1a1111;
  font-weight: 800;
}

.button--ghost {
  background: rgba(17, 16, 15, 0.38);
}

.icon-button {
  width: 46px;
  flex: 0 0 46px;
  font-size: 1.8rem;
}

.notice {
  display: grid;
  gap: 1px;
  margin-top: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.notice div {
  min-height: 94px;
  padding: 18px;
  background: rgba(25, 25, 24, 0.94);
}

.notice strong,
.notice span {
  display: block;
}

.notice span {
  margin-top: 6px;
  color: var(--muted);
}

.ad-slot-shell {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  min-height: 250px;
  justify-content: center;
  align-items: center;
  margin: 18px auto 0;
}

.ad-slot-shell--banner {
  min-height: 50px;
  margin-top: 16px;
}

.ad-slot-shell[hidden] {
  display: none;
}

.page--quiz {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 760px;
}

.topbar {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  padding-top: 4px;
}

.topbar h2 {
  margin-bottom: 0;
  font-size: 1.18rem;
  line-height: 1.18;
}

#answeredCount {
  color: var(--gold);
  font-weight: 800;
  white-space: nowrap;
}

.meter {
  height: 8px;
  border-radius: 999px;
  background: rgba(242, 239, 233, 0.09);
  overflow: hidden;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--teal));
  transition: width 180ms ease;
}

.question-card,
.results {
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(242, 239, 233, 0.045), rgba(242, 239, 233, 0.018)),
    rgba(25, 25, 24, 0.92);
  box-shadow: var(--shadow);
}

.question-card {
  display: flex;
  flex: 1;
  min-height: 520px;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px 18px 18px;
  overflow: hidden;
}

.question__top {
  display: grid;
  gap: 18px;
  margin-bottom: 24px;
}

.question__index {
  width: max-content;
  border: 1px solid rgba(231, 182, 91, 0.24);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(231, 182, 91, 0.08);
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 850;
}

.question__text {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.28rem, 6vw, 2.05rem);
  font-weight: 780;
  line-height: 1.32;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.question__scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.option {
  position: relative;
  min-width: 0;
}

.option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option span {
  display: grid;
  min-height: 64px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(242, 239, 233, 0.045);
  cursor: pointer;
  font-size: 1.08rem;
  font-weight: 760;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    border-color 160ms ease;
}

.option input:focus-visible + span {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.option input:checked + span {
  color: #171211;
  border-color: var(--gold);
  background: var(--gold);
  box-shadow: 0 12px 28px rgba(231, 182, 91, 0.16);
  font-weight: 850;
  transform: translateY(-1px);
}

.action-bar {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 0 env(safe-area-inset-bottom);
  background: linear-gradient(180deg, rgba(17, 16, 15, 0), var(--bg) 32%);
}

.action-bar .button {
  width: 100%;
}

.action-bar .button[hidden] {
  display: none;
}

.action-bar:has(.button[hidden]:first-child) {
  grid-template-columns: 1fr;
}

.action-bar:has(.button[hidden]:last-child) {
  grid-template-columns: 1fr;
}

.action-bar:has(.button[hidden]:first-child):has(.button[hidden]:last-child) {
  display: none;
}

.results {
  padding: 18px;
}

.results__header {
  justify-content: space-between;
  margin-bottom: 18px;
}

.results h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 9vw, 4rem);
}

.results__grid {
  display: grid;
  gap: 18px;
  align-items: start;
}

.chart-wrap {
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141312;
  display: grid;
  place-items: center;
  overflow: hidden;
}

#radarChart {
  display: block;
  width: 100%;
  height: auto;
  max-height: 72vh;
}

.summary h3 {
  margin: 18px 0 10px;
  font-size: 1rem;
}

.summary p {
  color: var(--muted);
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(80, 197, 183, 0.12);
  color: var(--teal);
  border: 1px solid rgba(80, 197, 183, 0.28);
  font-weight: 750;
}

.score-list {
  display: grid;
  gap: 9px;
}

.score-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.score-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(242, 239, 233, 0.08);
  overflow: hidden;
}

.score-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--teal));
}

.result-actions {
  margin-top: 20px;
}

.result-actions .button {
  flex: 1 1 148px;
}

@media (min-width: 760px) {
  .page {
    padding: 34px clamp(24px, 5vw, 72px) 44px;
  }

  .page--start {
    min-height: 100vh;
  }

  .hero__media::after {
    background: linear-gradient(90deg, rgba(17, 16, 15, 0.1), rgba(17, 16, 15, 0.76) 72%);
  }

  #heroCanvas {
    right: 0;
    width: min(72vw, 980px);
    height: min(72vw, 980px);
  }

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

  .lead {
    font-size: 1.18rem;
  }

  .question-card {
    min-height: 580px;
    padding: 44px;
  }

  .question__scale {
    gap: 12px;
  }

  .option span {
    min-height: 72px;
  }

  .action-bar {
    position: static;
    width: min(520px, 100%);
    margin-left: auto;
  }

  .results {
    padding: 24px;
  }

  .results__grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
    gap: 22px;
  }

  .score-list {
    max-height: 420px;
    overflow: auto;
    padding-right: 5px;
  }
}

@media (max-width: 380px) {
  .page {
    padding-left: 12px;
    padding-right: 12px;
  }

  .question-card {
    padding-left: 14px;
    padding-right: 14px;
    min-height: 500px;
  }

  .option span {
    min-height: 56px;
  }
}
