* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background:
    radial-gradient(circle at 15% 18%, rgba(255, 171, 92, .65), transparent 28%),
    radial-gradient(circle at 82% 12%, rgba(112, 196, 255, .75), transparent 34%),
    radial-gradient(circle at 75% 85%, rgba(158, 112, 255, .35), transparent 32%),
    linear-gradient(135deg, #fff0dc, #e3f4ff 55%, #f6edff);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
}

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

.quiz-card {
  max-width: 900px;
  min-height: 560px;
  height: auto;
  margin: auto;
  padding: 38px;
  border-radius: 34px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 30px 80px rgba(70, 100, 150, .25);
  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: #ff8a2a;
  font-weight: 900;
  letter-spacing: 1px;
}

h1 {
  margin: 0;
  font-size: 34px;
  color: #2f3855;
}

.counter {
  padding: 12px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff9b43, #69cfff);
  color: white;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(80, 160, 220, .35);
}

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

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff963d, #68d1ff, #9c7cff);
  transition: width .45s ease;
}

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

.question-box {
  position: relative;
  padding: 34px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255,255,255,.94), rgba(246,250,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 26px;
}

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

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

.option:hover {
  transform: translateY(-3px);
  background: linear-gradient(135deg, #fff3e7, #eff9ff);
  box-shadow: 0 16px 32px rgba(120, 150, 200, .23);
}

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

.fox-loader {
  width: 90px;
  height: 90px;
  display: grid;
  place-items: center;
  font-size: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff6e8, #eaf7ff);
  box-shadow: 0 16px 35px rgba(95, 150, 210, .25);
  animation: floatFox 1.4s ease-in-out infinite alternate;
}

.loading-screen h2 { margin: 24px 0 8px; color: #405070; }
.loading-screen p { margin: 0; color: #8191a9; }

.result {
  padding: 30px 10px;
  text-align: center;
  color: #4a5a76;
}

.result h2 {
  margin: 0 0 8px;
  font-size: 30px;
  color: #2f3855;
}

.result strong {
  color: #ff812b;
  font-size: 52px;
}

.result p {
  font-size: 17px;
  line-height: 1.7;
  margin: 10px auto;
  max-width: 720px;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 18px auto 6px;
  max-width: 760px;
}

.score-item {
  padding: 12px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 8px 22px rgba(100, 140, 190, .12);
  font-weight: 800;
  color: #40506d;
}

.code-box, .compare-box {
  margin: 20px auto 0;
  padding: 18px;
  max-width: 760px;
  border-radius: 24px;
  background: rgba(255, 255, 255, .72);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.9);
}

.code-textarea, .friend-code-input {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border: 0;
  outline: none;
  border-radius: 18px;
  padding: 14px;
  color: #3c4962;
  background: #fff;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: inset 0 0 0 1px rgba(120, 160, 210, .16);
}

.friend-code-input { min-height: 76px; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
}

.save-btn {
  border: none;
  padding: 14px 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff963d, #69cfff);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(95, 160, 220, .35);
  transition: .22s ease;
}

.save-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 38px rgba(95, 160, 220, .45);
}

.home-btn { background: linear-gradient(135deg, #8795aa, #adb9c9); }

.tip {
  margin-top: 10px;
  font-size: 13px;
  color: #7b879d;
}

.compare-result {
  margin: 20px auto 0;
  padding: 26px 18px;
  max-width: 760px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255,246,229,.95), rgba(235,248,255,.95));
  box-shadow: 0 16px 36px rgba(100, 140, 190, .18);
}

.compare-result .big-similarity {
  display: block;
  margin: 8px 0;
  font-size: 62px;
  color: #ff812b;
  font-weight: 1000;
}

@keyframes floatFox {
  from { transform: translateY(0) rotate(-4deg); }
  to { transform: translateY(-10px) rotate(4deg); }
}

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

@media (max-width: 720px) {
  body { overflow-x: hidden; overflow-y: auto; align-items: flex-start; }
  .page { padding: 18px; }
  .quiz-card { padding: 22px; min-height: auto; }
  h1 { font-size: 25px; }
  .top { align-items: flex-start; flex-direction: column; }
  .question-stage { min-height: auto; }
  .question-title { font-size: 21px; }
  .score-grid { grid-template-columns: repeat(2, 1fr); }
  .result strong { font-size: 42px; }
}
