html,
body {
  background: #d9ecff;
}

.game-page,
.quiz-page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
  color: #123a7a;
}

.quiz-page-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.quiz-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 750px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top, 0px) + 0.75rem)
    1rem
    calc(env(safe-area-inset-bottom, 0px) + 1rem);
  box-sizing: border-box;
}

.quiz-header {
  flex: 0 0 auto;
  align-items: center;
}

.quiz-back-btn {
  flex: 0 0 auto;
}

.quiz-header__title {
  min-width: 0;
  text-align: center;
  color: #fff;
  text-shadow: 0 0.18rem 0.45rem rgb(0 38 112 / 0.3);
}

.quiz-header__title span,
.quiz-header__title strong {
  display: block;
  letter-spacing: 0;
}

.quiz-header__title span {
  font-size: clamp(0.78rem, 3.3vw, 0.95rem);
  font-weight: 700;
}

.quiz-header__title strong {
  margin-top: 0.15rem;
  font-size: clamp(1rem, 4.2vw, 1.25rem);
  font-weight: 900;
}

.quiz-header__rank,
.quiz-header__spacer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.1rem;
  height: 2.25rem;
}

.quiz-header__rank {
  border-radius: 999px;
  background: rgb(255 255 255 / 0.88);
  color: #1664c7;
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 0.4rem 0.9rem rgb(0 48 130 / 0.15);
}

.quiz-card {
  width: 100%;
  margin: auto 0;
  padding: clamp(1rem, 4vw, 1.35rem);
  border: 1px solid rgb(255 255 255 / 0.34);
  border-radius: 1.15rem;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.95), rgb(234 247 255 / 0.9));
  box-shadow:
    0 1rem 2rem rgb(0 53 126 / 0.18),
    inset 0 1px 0 rgb(255 255 255 / 0.7);
  box-sizing: border-box;
}

.quiz-intro {
  text-align: center;
}

.quiz-kicker {
  margin: 0 0 0.75rem;
  color: #1c84f4;
  font-size: 0.86rem;
  font-weight: 900;
}

.quiz-intro h1,
.quiz-result h2 {
  margin: 0;
  color: #123a7a;
  font-size: clamp(1.45rem, 6vw, 2.25rem);
  line-height: 1.2;
  font-weight: 900;
}

.quiz-intro p,
.quiz-result p {
  margin: 0.82rem 0 0;
  color: #315a8d;
  font-size: clamp(0.92rem, 3.7vw, 1.05rem);
  line-height: 1.75;
}

.quiz-knowledge {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 0.85rem;
  background: #f5fbff;
  text-align: left;
}

.quiz-knowledge p {
  margin: 0;
  color: #254f82;
  font-size: clamp(0.92rem, 3.7vw, 1.02rem);
  line-height: 1.72;
  font-weight: 700;
}

.quiz-knowledge p + p {
  margin-top: 0.55rem;
}

.quiz-rule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 1.15rem 0;
}

.quiz-rule-grid span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  border-radius: 0.85rem;
  background: #e0f1ff;
  color: #1664c7;
  font-size: 0.86rem;
  font-weight: 900;
}

.quiz-primary-btn,
.quiz-secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0 1.25rem;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.quiz-primary-btn {
  background: linear-gradient(180deg, #fff5a8 0%, #ffc44a 100%);
  color: #783c00;
  box-shadow: 0 0.55rem 1rem rgb(188 105 0 / 0.22);
}

.quiz-secondary-btn {
  border: 1px solid rgb(22 100 199 / 0.16);
  background: #eaf5ff;
  color: #1664c7;
}

.quiz-primary-btn:disabled,
.quiz-secondary-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.quiz-status-text {
  min-height: 1.5em;
  font-size: 0.85rem !important;
  color: #5b7698 !important;
}

.quiz-panel {
  margin-block: 1rem;
}

.quiz-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: #1664c7;
  font-size: 0.92rem;
  font-weight: 900;
}

.quiz-timer {
  min-width: 4.3rem;
  padding: 0.38rem 0.65rem;
  border-radius: 999px;
  background: #fff4b8;
  color: #a55300;
  text-align: center;
}

.quiz-progressbar {
  height: 0.45rem;
  margin: 0.85rem 0 1.1rem;
  border-radius: 999px;
  background: #d7ecff;
  overflow: hidden;
}

.quiz-progressbar span {
  display: block;
  width: 20%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #18b4ff, #ffd34f);
  transition: width 0.2s ease;
}

.quiz-question {
  margin: 0;
  color: #123a7a;
  font-size: clamp(1.08rem, 4.6vw, 1.42rem);
  line-height: 1.5;
  font-weight: 900;
}

.quiz-options {
  display: grid;
  gap: 0.72rem;
  margin-top: 1rem;
}

.quiz-option {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  align-items: center;
  gap: 0.72rem;
  width: 100%;
  min-height: 3.35rem;
  padding: 0.72rem 0.8rem;
  border: 2px solid transparent;
  border-radius: 0.95rem;
  background: #f8fcff;
  color: #254f82;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.45;
  text-align: left;
  box-shadow: 0 0.35rem 0.85rem rgb(0 55 130 / 0.08);
  cursor: pointer;
}

.quiz-option.is-selected {
  border-color: #ffc44a;
  background: #fff7cc;
  color: #123a7a;
}

.quiz-option__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: #e0f1ff;
  color: #1664c7;
  font-weight: 900;
}

.quiz-option.is-selected .quiz-option__key {
  background: #ffc44a;
  color: #793a00;
}

.quiz-option--multi .quiz-option__key {
  border-radius: 0.65rem;
}

.quiz-option--multi.is-selected .quiz-option__key::after {
  content: "✓";
  margin-left: 0.16rem;
  font-size: 0.78em;
}

.quiz-actions,
.quiz-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.15rem;
}

.quiz-score {
  color: #ff9d00 !important;
  font-size: clamp(2.4rem, 11vw, 4rem) !important;
  line-height: 1 !important;
  font-weight: 900;
}

.certificate-card {
  margin-top: 0.9rem;
  padding: 0.62rem;
  border-radius: 0.9rem;
  background:
    linear-gradient(135deg, #fff4aa, #f7bf45 44%, #fff3b0),
    #ffd66a;
  box-shadow: 0 0.85rem 1.5rem rgb(161 96 0 / 0.16);
}

.certificate-card__inner {
  min-height: 22rem;
  padding: 1.25rem 1rem;
  border: 2px solid rgb(157 94 8 / 0.2);
  border-radius: 0.62rem;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.95), rgb(246 252 255 / 0.92)),
    #fff;
  text-align: center;
}

.certificate-card__kicker {
  margin: 0;
  color: #1664c7 !important;
  font-size: 0.88rem !important;
  font-weight: 900;
}

.certificate-card h2 {
  margin: 0.32rem 0 0;
  color: #123a7a;
  font-size: clamp(1.22rem, 5.2vw, 1.85rem);
  line-height: 1.25;
}

.certificate-card__name {
  margin: 1.1rem 0 0 !important;
  color: #a55300 !important;
  font-size: clamp(1.55rem, 7vw, 2.35rem) !important;
  line-height: 1.15 !important;
  font-weight: 900;
}

.certificate-card__desc {
  margin: 0.9rem auto 0 !important;
  max-width: 28rem;
  color: #315a8d !important;
  font-size: 0.98rem !important;
  line-height: 1.7 !important;
}

.certificate-card__score {
  display: grid;
  gap: 0.28rem;
  margin: 1.05rem auto 0;
}

.certificate-card__score span {
  color: #ff9d00;
  font-size: clamp(2.3rem, 11vw, 4rem);
  line-height: 1;
  font-weight: 900;
}

.certificate-card__score small {
  color: #486b92;
  font-size: 0.92rem;
  font-weight: 800;
}

.certificate-card__date,
.certificate-card__org {
  margin: 0.82rem 0 0 !important;
  color: #486b92 !important;
  font-size: 0.84rem !important;
  line-height: 1.55 !important;
}

.certificate-card__org {
  margin-top: 1.15rem !important;
  color: #17437b !important;
  font-weight: 900;
}

.quiz-toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1.1rem);
  z-index: 60;
  max-width: calc(100vw - 2rem);
  padding: 0.72rem 1rem;
  border-radius: 999px;
  background: rgb(15 42 91 / 0.88);
  color: #fff;
  font-size: 0.92rem;
  line-height: 1.35;
  text-align: center;
  transform: translateX(-50%);
}

.certificate-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 1rem) 1rem
    calc(env(safe-area-inset-bottom, 0px) + 1rem);
  background: rgb(6 24 58 / 0.62);
  box-sizing: border-box;
}

.certificate-preview-modal__panel {
  width: min(100%, 28rem);
  max-height: 100%;
  padding: 0.85rem;
  border-radius: 0.95rem;
  background: #ffffff;
  text-align: center;
  box-shadow: 0 1.2rem 2.4rem rgb(0 30 80 / 0.28);
  overflow: auto;
}

.certificate-preview-modal__panel img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.62rem;
  background: #f5fbff;
}

.certificate-preview-modal__panel p {
  margin: 0.72rem 0;
  color: #315a8d;
  font-size: 0.9rem;
  line-height: 1.4;
  font-weight: 800;
}

.hidden {
  display: none !important;
}

@media (max-width: 420px) {
  .quiz-shell {
    padding-inline: 0.78rem;
  }

  .quiz-card {
    padding: 0.95rem;
  }

  .quiz-rule-grid {
    gap: 0.4rem;
  }

  .quiz-rule-grid span {
    font-size: 0.78rem;
  }
}
