:root {
  --bg: #f4f2e8;
  --paper: #fffdf6;
  --ink: #1c1a17;
  --line: #d7cfbc;
  --subtle: #6a6458;
  --brand: #bb1f1f;
  --brand-soft: #ffe2b2;
  --brand-2: #f07c2f;
  --ok: #205c39;
  --warn: #8b5b00;
  --cold: #244e7b;
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 14px 44px rgba(47, 36, 17, 0.14);
  --font-title: "ZCOOL KuaiLe", "Ma Shan Zheng", "Noto Sans SC", sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% -10%, #fff9d8 0%, transparent 40%),
    radial-gradient(circle at 90% 110%, #ffdcb9 0%, transparent 38%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  padding: 20px;
  display: flex;
  justify-content: center;
}

.app {
  width: min(860px, 100%);
  min-height: calc(100vh - 40px);
  background: linear-gradient(180deg, #fffef9 0%, #fff8ea 100%);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.13;
  background-image: radial-gradient(circle at 1px 1px, #9b8d72 1px, transparent 0);
  background-size: 22px 22px;
}

.page {
  display: none;
  min-height: calc(100vh - 40px);
  padding: 22px;
  position: relative;
  z-index: 2;
}

.page.active {
  display: flex;
  flex-direction: column;
  animation: page-in 0.35s ease;
}

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

.home-head,
.quiz-head,
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  background: #26211b;
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  padding: 7px 14px;
  letter-spacing: 0.7px;
}

.title-main {
  font-family: var(--font-title);
  font-size: clamp(44px, 9vw, 74px);
  margin-top: 14px;
  line-height: 1;
  color: var(--brand);
  text-shadow: 2px 2px 0 #ffd69f;
}

.title-sub {
  margin-top: 12px;
  color: var(--subtle);
  font-size: 16px;
  line-height: 1.8;
}

.marquee-wrap {
  margin-top: 16px;
  border: 1px dashed #e0c7a0;
  background: linear-gradient(90deg, #fff6df, #ffeac8);
  border-radius: 999px;
  overflow: hidden;
  padding: 8px 0;
}

.marquee {
  white-space: nowrap;
  color: #8c5021;
  font-size: 12px;
  font-weight: 700;
  animation: marquee 20s linear infinite;
}

@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.home-cards {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.card-mini {
  background: #fff9e9;
  border: 1px solid #efdcba;
  border-radius: var(--radius-md);
  padding: 12px;
}

.card-mini h3 {
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 4px;
}

.card-mini p {
  font-size: 12px;
  color: #625746;
  line-height: 1.5;
}

.stats {
  margin-top: 14px;
  border: 1px solid #d9cfbb;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 14px;
}

.stats h2 {
  font-size: 13px;
  margin-bottom: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.stats-grid div {
  background: #fcf7ea;
  border: 1px solid #e8dcc6;
  border-radius: 10px;
  padding: 8px;
  text-align: center;
}

.stats-grid span {
  font-size: 15px;
  font-weight: 900;
  display: block;
}

.stats-grid label {
  margin-top: 2px;
  display: block;
  font-size: 11px;
  color: #716657;
}

.stats-note {
  margin-top: 8px;
  font-size: 12px;
  color: #7b6f5f;
}

.home-actions,
.result-actions,
.quiz-actions {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.home-xhs-note {
  margin-top: 2px;
  text-align: center;
  font-size: 13px;
  color: #6e6252;
}

.home-xhs-handle {
  margin-left: 6px;
  color: #c11f1f;
  font-weight: 800;
  text-decoration: none;
  border-bottom: 1px dashed #de8f8f;
}

.home-xhs-handle:hover {
  color: #9f1313;
}

.btn,
.icon-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.btn:active,
.icon-btn:active {
  transform: scale(0.985);
  opacity: 0.92;
}

.btn {
  border-radius: 999px;
  font-weight: 700;
}

.btn.primary {
  background: #17130f;
  color: #fff;
  padding: 15px 18px;
  letter-spacing: 0.8px;
  font-size: 15px;
}

.btn.ghost {
  background: #fff;
  color: #2c271f;
  border: 1px solid var(--line);
  padding: 13px 16px;
  font-size: 14px;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 18px;
  color: #2f2a22;
}

.icon-btn.small {
  width: auto;
  height: auto;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px;
}

.counter,
.date {
  font-size: 13px;
  color: #71695d;
  font-weight: 600;
}

.progress {
  margin-top: 14px;
  height: 8px;
  border-radius: 999px;
  background: #eee4d3;
  border: 1px solid #dfcfb5;
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width 0.28s ease;
}

.question-card {
  margin-top: 16px;
  background: #fff;
  border: 1px solid #ddd2be;
  border-radius: var(--radius-xl);
  padding: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.question-card.bump {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(65, 46, 19, 0.12);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 12px;
  background: #372f25;
  color: #fff;
  padding: 7px 11px;
}

.question {
  margin-top: 12px;
  font-size: clamp(21px, 3.6vw, 30px);
  font-weight: 900;
  line-height: 1.5;
}

.tip {
  margin-top: 10px;
  border-radius: 10px;
  border: 1px dashed #dcc6a3;
  background: #fff5e0;
  padding: 10px;
  color: #5f513b;
  font-size: 13px;
}

.options {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.option {
  width: 100%;
  text-align: left;
  border: 1px solid #d7cdbc;
  background: #fff;
  border-radius: var(--radius-md);
  padding: 13px;
  font-size: 14px;
  line-height: 1.65;
  color: #342e27;
}

.option:hover {
  border-color: #baa486;
  background: #fffcf5;
}

.option.active {
  border-color: var(--brand);
  background: #fff2ef;
  box-shadow: inset 0 0 0 1px rgba(187, 31, 31, 0.3);
}

.result-hero {
  margin-top: 12px;
  border-radius: var(--radius-xl);
  border: 1px solid #d7c7a8;
  background:
    radial-gradient(circle at 90% 20%, rgba(255, 204, 133, 0.35), transparent 30%),
    linear-gradient(165deg, #fffdf8, #ffeecf);
  padding: 16px;
}

.result-type {
  font-family: var(--font-title);
  font-size: clamp(38px, 10vw, 64px);
  line-height: 1;
  color: var(--brand);
  text-shadow: 2px 2px 0 #ffd8a8;
}

.result-name {
  margin-top: 8px;
  font-size: clamp(22px, 5vw, 30px);
  line-height: 1.35;
}

.result-tags {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.7;
  color: #5d5447;
}

.level {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid;
  font-size: 12px;
  font-weight: 700;
}

.level[data-level="3"] {
  background: #ffe7dd;
  color: #8d2d10;
  border-color: #f0b195;
}

.level[data-level="2"] {
  background: #fff1da;
  color: #7f4f00;
  border-color: #f0c078;
}

.level[data-level="1"] {
  background: #ebf7e6;
  color: var(--ok);
  border-color: #9ec89c;
}

.level[data-level="0"] {
  background: #ecf2ff;
  color: var(--cold);
  border-color: #a8bee4;
}

.panel {
  margin-top: 12px;
  border: 1px solid #d8cfbd;
  border-radius: var(--radius-lg);
  background: #fff;
  padding: 13px;
}

.panel h3 {
  font-size: 13px;
  margin-bottom: 8px;
}

.long-text {
  white-space: pre-wrap;
  color: #383229;
  font-size: 14px;
  line-height: 1.82;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.list {
  list-style: none;
  display: grid;
  gap: 7px;
}

.list li {
  font-size: 13px;
  line-height: 1.6;
  color: #4d4438;
  padding-left: 14px;
  position: relative;
}

.list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #b1672b;
}

.bars {
  display: grid;
  gap: 8px;
}

.bar-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
}

.bar-item span,
.bar-item em {
  font-size: 12px;
  color: #5d5449;
  font-style: normal;
}

.bar-track {
  height: 8px;
  border-radius: 999px;
  background: #ece2d3;
  border: 1px solid #dccdb4;
  overflow: hidden;
}

.bar-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width 0.36s ease;
}

.share-preview img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #dac8a8;
  background: #fff7e9;
  display: none;
}

.share-preview img.show {
  display: block;
}

@media (max-width: 720px) {
  body {
    padding: 0;
    background: var(--paper);
  }

  .app {
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  .page {
    min-height: 100vh;
  }

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

  .home-cards,
  .two-col {
    grid-template-columns: 1fr;
  }
}
