* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background:
    radial-gradient(circle at 20% 20%, rgba(168, 190, 255, .62), transparent 30%),
    radial-gradient(circle at 80% 15%, rgba(210, 176, 255, .7), transparent 35%),
    linear-gradient(135deg, #e9f2ff, #f2eaff 55%, #fff7fb);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
}

.page {
  width: 100%;
  padding: 30px;
}

.quiz-card {
  max-width: 860px;
  min-height: 520px;
  margin: auto;
  padding: 38px;
  border-radius: 34px;
  background: rgba(255, 255, 255, .8);
  box-shadow: 0 30px 80px rgba(110, 130, 190, .22);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, .9);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.sub-title {
  margin: 0 0 6px;
  color: #7b7cff;
  font-weight: 700;
  letter-spacing: 1px;
}

h1 {
  margin: 0;
  font-size: 34px;
  color: #33415c;
}

.counter {
  padding: 12px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #8fa2ff, #d99cff);
  color: white;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(128, 145, 230, .32);
}

.progress-wrap {
  width: 100%;
  height: 14px;
  margin: 30px 0;
  border-radius: 999px;
  background: rgba(190, 200, 235, .45);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8fa2ff, #d99cff);
  transition: width .45s ease;
}

.question-stage {
  position: relative;
  min-height: 430px;
  overflow: visible;
}

.question-box {
  position: relative;
  min-height: 430px;
  padding: 34px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255,255,255,.94), rgba(247,249,255,.94));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.9);
  animation: slideIn .42s ease forwards;
}

.question-box.leave {
  animation: slideOut .38s ease forwards;
}

.question-title {
  font-size: 26px;
  line-height: 1.45;
  color: #2f3a56;
  margin: 0 0 28px;
}

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

.option {
  border: 0;
  width: 100%;
  padding: 16px 20px;
  border-radius: 18px;
  background: white;
  color: #40506d;
  font-size: 17px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(130, 145, 200, .15);
  transition: .22s ease;
}

.option:hover {
  transform: translateY(-3px);
  background: linear-gradient(135deg, #f1f4ff, #fbf1ff);
  box-shadow: 0 16px 32px rgba(130, 145, 200, .22);
}

.loading,
.result {
  padding: 58px 20px;
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  color: #567;
}

.result strong {
  display: block;
  margin: 12px 0;
  color: #6075ff;
  font-size: 58px;
}

.result p {
  font-size: 18px;
  line-height: 1.7;
  font-weight: 700;
  margin: 10px auto;
  max-width: 620px;
}

.result small {
  display: inline-block;
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.8;
  color: #7b879e;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(80px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(-90px) scale(.96);
  }
}

.loading-screen {
  height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.circle-loader {
  width: 90px;
  height: 90px;
  position: relative;
}

.circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 8px solid rgba(255,255,255,.45);
  border-top-color: #8fa2ff;
  border-right-color: #d99cff;
  animation: spin 1s linear infinite;
}

.circle::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(143,162,255,.22), rgba(217,156,255,.22));
}

.loading-screen h2 {
  margin-top: 25px;
  color: #405070;
}

.loading-screen p {
  color: #8191a9;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.save-btn {
  margin: 24px 8px 0;
  border: none;
  padding: 14px 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, #8fa2ff, #d99cff);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(128, 145, 230, .34);
  transition: .22s ease;
}

.save-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 38px rgba(128, 145, 230, .44);
}

.save-btn:active {
  transform: translateY(0);
}

.home-btn {
  background: linear-gradient(135deg, #9aa8bd, #6f7f9a);
}

@media (max-width: 640px) {
  body {
    overflow: auto;
  }

  .quiz-card {
    padding: 24px;
  }

  h1 {
    font-size: 26px;
  }

  .top {
    align-items: flex-start;
    flex-direction: column;
  }

  .question-stage {
    min-height: 460px;
  }

  .question-box {
    position: relative;
    min-height: 460px;
    padding: 26px;
  }

  .option {
    padding: 15px 16px;
    font-size: 16px;
  }

  .question-title {
    font-size: 21px;
  }
}
