:root {
  --red: #f04432;
  --red-dark: #c83224;
  --orange: #ff7a2f;
  --yellow: #ffd84d;
  --cream: #fff8e8;
  --brown: #5b2a1d;
  --green: #35b86b;
  --error: #e8483f;
  --white: #ffffff;
  --shadow: 0 16px 36px rgba(126, 45, 24, 0.16);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: #2d1a16;
  color: var(--brown);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid #3487ff;
  outline-offset: 3px;
}

.app-shell {
  position: relative;
  width: min(100%, 430px);
  min-height: 100svh;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(circle at 84% 8%, rgba(255, 216, 77, 0.58) 0 11%, transparent 11.4%),
    radial-gradient(circle at 3% 72%, rgba(255, 122, 47, 0.18) 0 13%, transparent 13.4%),
    var(--cream);
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.4);
}

.ambient {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  border-radius: 999px;
  filter: blur(0.2px);
}

.ambient-one {
  width: 150px;
  height: 150px;
  left: calc(50% - 360px);
  top: -70px;
  background: var(--red);
}

.ambient-two {
  width: 108px;
  height: 108px;
  right: calc(50% - 248px);
  top: 88px;
  border: 20px solid rgba(255, 122, 47, 0.2);
}

.ambient-three {
  width: 18px;
  height: 18px;
  left: calc(50% + 138px);
  top: 52%;
  background: var(--yellow);
  box-shadow: -302px 108px 0 var(--orange), -286px 88px 0 -4px var(--red);
}

.screen {
  position: relative;
  z-index: 1;
  display: none;
  width: 100%;
  min-height: 100svh;
  padding: max(22px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  animation: screen-in 0.32s ease both;
}

.screen.is-active {
  display: flex;
  flex-direction: column;
}

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

.eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.home-copy {
  position: relative;
  z-index: 2;
}

.home-copy h1 {
  margin: 12px 0 6px;
  font-size: clamp(38px, 11vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.055em;
}

.home-copy h1 span {
  display: inline-block;
  color: var(--red);
  text-shadow: 3px 3px 0 var(--yellow);
}

.lead {
  margin: 0;
  color: #7c4b3b;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.6;
}

.hero-wrap {
  position: relative;
  flex: 1;
  min-height: 330px;
  margin: 4px -20px -2px;
}

.hero-glow {
  position: absolute;
  width: 280px;
  height: 280px;
  left: 50%;
  top: 49%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 216, 77, 0.74), rgba(255, 216, 77, 0.08) 68%, transparent 69%);
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 14px 16px rgba(126, 45, 24, 0.2));
}

.float-badge {
  position: absolute;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 4px solid var(--white);
  border-radius: 18px;
  background: var(--red);
  color: var(--white);
  font-weight: 900;
  box-shadow: var(--shadow);
  animation: bob 2.6s ease-in-out infinite;
}

.badge-one {
  left: 26px;
  top: 42%;
}

.badge-two {
  right: 24px;
  top: 17%;
  background: var(--yellow);
}

@keyframes bob {
  50% {
    transform: translateY(-8px) rotate(3deg);
  }
}

.screen-actions {
  margin-top: auto;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 26px;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.primary-button {
  background: var(--red);
  color: var(--white);
  box-shadow: 0 6px 0 var(--red-dark);
}

.secondary-button {
  background: var(--yellow);
  color: var(--brown);
  box-shadow: 0 5px 0 #e7b832;
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(4px) scale(0.99);
  box-shadow: 0 2px 0 var(--red-dark);
}

.text-button {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: #8d5b4c;
  font-weight: 800;
  cursor: pointer;
}

.micro-copy {
  margin: 16px 0 0;
  text-align: center;
  color: #966453;
  font-size: 13px;
  font-weight: 700;
}

.simple-header,
.quiz-header {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.simple-header h2,
.quiz-header h2 {
  margin: 2px 0 0;
  font-size: 25px;
  letter-spacing: -0.04em;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid rgba(240, 68, 50, 0.12);
  border-radius: 15px;
  background: var(--white);
  color: var(--brown);
  font-size: 23px;
  font-weight: 900;
  box-shadow: 0 7px 16px rgba(126, 45, 24, 0.08);
  cursor: pointer;
}

.header-sticker {
  font-size: 32px;
  text-align: right;
}

.rules-card,
.question-card,
.result-summary {
  border: 2px solid rgba(240, 68, 50, 0.08);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.rules-card {
  padding: 8px 16px;
}

.rule-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rule-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  border-bottom: 1px dashed #efd3c4;
}

.rule-list li:last-child {
  border-bottom: 0;
}

.rule-list li > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  background: #fff0d0;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
}

.rule-list p {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.rule-list strong {
  color: var(--red);
}

.rank-board {
  display: grid;
  gap: 9px;
  margin: 14px 0 18px;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 14px;
  border-radius: 19px;
}

.rank-top {
  background: linear-gradient(135deg, #ffed9e, #ffd84d);
}

.rank-mid {
  background: linear-gradient(135deg, #ffd5ad, #ff9d51);
}

.rank-start {
  background: linear-gradient(135deg, #ffc8bf, #ff887a);
}

.rank-icon {
  min-width: 78px;
  font-size: 16px;
}

.rank-row p {
  display: grid;
  gap: 2px;
  margin: 0;
}

.rank-row strong {
  font-size: 13px;
}

.rank-row small {
  font-size: 15px;
  font-weight: 900;
}

.quiz-header {
  grid-template-columns: 46px 1fr auto;
  margin-bottom: 10px;
}

.quiz-progress-copy {
  display: grid;
  gap: 1px;
}

.quiz-progress-copy strong {
  font-size: 17px;
}

.quiz-progress-copy span {
  color: #a06f60;
  font-size: 12px;
  font-weight: 700;
}

.score-pill {
  min-width: 68px;
  padding: 10px 12px;
  border-radius: 18px;
  background: var(--yellow);
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.score-pill span {
  color: var(--red);
  font-size: 20px;
}

.progress-track {
  height: 10px;
  margin: 3px 2px 20px;
  overflow: hidden;
  border-radius: 99px;
  background: #f0ded2;
}

.progress-fill {
  width: 10%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--red));
  transition: width 0.3s ease;
}

.question-card {
  padding: 18px;
}

.question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--red);
  font-size: 13px;
  font-weight: 900;
}

.question-meta span:last-child {
  font-size: 28px;
}

.question-card h2 {
  min-height: 78px;
  margin: 10px 0 16px;
  font-size: 21px;
  line-height: 1.45;
  letter-spacing: -0.025em;
}

.option-list {
  display: grid;
  gap: 11px;
}

.option-button {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 10px 14px 10px 10px;
  border: 2px solid #ffd17a;
  border-radius: 18px;
  background: var(--white);
  color: var(--brown);
  text-align: left;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

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

.option-letter {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  background: #fff1ce;
  color: var(--red);
  font-weight: 900;
}

.option-status {
  font-size: 12px;
}

.option-button.is-correct {
  border-color: var(--green);
  background: #eaf9f0;
}

.option-button.is-correct .option-letter {
  background: var(--green);
  color: var(--white);
}

.option-button.is-wrong {
  border-color: var(--error);
  background: #ffefed;
}

.option-button.is-wrong .option-letter {
  background: var(--error);
  color: var(--white);
}

.option-button.is-muted {
  opacity: 0.56;
}

.feedback-card {
  margin-top: 12px;
  padding: 14px 15px;
  border: 2px solid #bee8ce;
  border-radius: 20px;
  background: #effbf3;
}

.feedback-card.is-wrong {
  border-color: #f6c3bd;
  background: #fff2ef;
}

.feedback-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feedback-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 14px;
  background: var(--green);
  color: var(--white);
  font-size: 22px;
  font-weight: 900;
}

.feedback-card.is-wrong .feedback-icon {
  background: var(--error);
}

.feedback-heading > div {
  display: grid;
  gap: 2px;
}

.feedback-heading strong {
  font-size: 16px;
}

.feedback-heading span {
  color: #8d5b4c;
  font-size: 12px;
  font-weight: 700;
}

.feedback-card > p {
  margin: 10px 0 0;
  color: #6f4538;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}

.quiz-actions {
  padding-top: 14px;
}

.result-header {
  text-align: center;
}

.result-header h2 {
  margin: 6px 0 0;
  font-size: 30px;
}

.confetti {
  display: block;
  color: var(--yellow);
  font-size: 34px;
}

.result-medal {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 270px;
  margin-top: 2px;
}

.medal-rays {
  position: absolute;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 8deg, rgba(255, 216, 77, 0.7) 0 10deg, transparent 10deg 20deg);
  animation: slow-spin 18s linear infinite;
}

@keyframes slow-spin {
  to {
    transform: rotate(360deg);
  }
}

.score-ring {
  position: relative;
  display: grid;
  width: 146px;
  height: 146px;
  place-content: center;
  border: 10px solid var(--white);
  border-radius: 50%;
  background: linear-gradient(145deg, var(--red), var(--orange));
  color: var(--white);
  text-align: center;
  box-shadow: 0 15px 0 #d63828, 0 24px 40px rgba(126, 45, 24, 0.25);
  animation: medal-pop 0.52s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes medal-pop {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
}

.score-ring strong {
  font-size: 56px;
  line-height: 0.9;
}

.score-ring span {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 900;
}

.title-ribbon {
  position: absolute;
  bottom: 20px;
  min-width: 210px;
  padding: 12px 18px;
  border: 4px solid var(--white);
  border-radius: 16px;
  background: var(--yellow);
  text-align: center;
  font-size: 17px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(126, 45, 24, 0.18);
}

.result-summary {
  padding: 17px 18px;
  text-align: center;
}

.result-summary p {
  margin: 0;
  font-weight: 800;
}

.result-summary strong {
  color: var(--red);
  font-size: 22px;
}

.result-stars {
  margin: 8px 0;
  letter-spacing: 6px;
}

.result-summary .result-message {
  color: #8d5b4c;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}

.result-actions,
.share-actions {
  display: grid;
  gap: 12px;
  padding-top: 18px;
}

.share-header {
  margin-bottom: 12px;
}

.share-card {
  position: relative;
  width: min(100%, 335px);
  min-height: 470px;
  margin: 0 auto;
  overflow: hidden;
  border: 6px solid var(--white);
  border-radius: 28px;
  background:
    radial-gradient(circle at 92% 5%, rgba(255, 216, 77, 0.55) 0 12%, transparent 12.5%),
    linear-gradient(180deg, #f04432 0 30%, #fff8e8 30% 100%);
  text-align: center;
  box-shadow: 0 22px 50px rgba(126, 45, 24, 0.25);
}

.share-card-top {
  display: grid;
  gap: 0;
  padding: 16px 20px 0;
  color: var(--white);
}

.share-card-top span {
  font-size: 22px;
  font-weight: 900;
}

.share-card-top small {
  color: #ffe791;
  font-weight: 900;
  letter-spacing: 0.24em;
}

.share-card img {
  width: 170px;
  height: 185px;
  margin-top: -2px;
  object-fit: cover;
  object-position: center 42%;
  border: 5px solid var(--white);
  border-radius: 26px;
  box-shadow: 0 10px 22px rgba(126, 45, 24, 0.18);
}

.share-score {
  display: grid;
  gap: 0;
  margin-top: 3px;
}

.share-score span {
  color: #966453;
  font-size: 11px;
  font-weight: 800;
}

.share-score strong {
  color: var(--red);
  font-size: 18px;
}

.share-score b {
  font-size: 35px;
}

.share-title {
  display: inline-block;
  margin: 4px auto;
  padding: 7px 16px;
  border-radius: 99px;
  background: var(--yellow);
  font-size: 15px;
  font-weight: 900;
}

.share-card > p {
  margin: 5px 0;
  font-size: 13px;
  font-weight: 800;
}

.share-card blockquote {
  margin: 7px 0 0;
  color: #8d5b4c;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.share-card-footer {
  display: grid;
  grid-template-columns: auto 1fr 42px;
  align-items: center;
  gap: 8px;
  margin: 10px 14px 0;
  padding-top: 8px;
  border-top: 1px dashed #e7c9b8;
  text-align: left;
}

.share-card-footer small {
  color: #8d5b4c;
  font-size: 10px;
  font-weight: 800;
}

.qr-placeholder {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 2px solid var(--brown);
  color: var(--brown);
  font-size: 10px;
  font-weight: 900;
}

.modal-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(45, 26, 22, 0.64);
  backdrop-filter: blur(8px);
}

.dialog-card {
  width: min(100%, 340px);
  padding: 24px;
  border-radius: 26px;
  background: var(--cream);
  text-align: center;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.3);
}

.dialog-icon {
  font-size: 48px;
}

.dialog-card h2 {
  margin: 8px 0;
}

.dialog-card p {
  margin: 0 0 18px;
  color: #8d5b4c;
  font-weight: 700;
}

.dialog-card .text-button {
  width: 100%;
  margin-top: 8px;
}

.danger-text {
  color: var(--error);
}

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  max-width: calc(100% - 48px);
  padding: 11px 16px;
  border-radius: 99px;
  background: rgba(45, 26, 22, 0.92);
  color: var(--white);
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: 0.22s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

[hidden] {
  display: none !important;
}

@media (max-height: 710px) {
  .screen {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .hero-wrap {
    min-height: 286px;
  }

  .rules-card {
    padding-block: 4px;
  }

  .rule-list li {
    min-height: 50px;
  }

  .rank-row {
    min-height: 54px;
    padding-block: 7px;
  }

  .question-card {
    padding: 15px;
  }

  .question-card h2 {
    min-height: 58px;
    margin-block: 6px 12px;
    font-size: 19px;
  }

  .option-button {
    min-height: 52px;
  }

  .share-card {
    transform: scale(0.9);
    transform-origin: top center;
    margin-bottom: -46px;
  }
}

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