:root { --c: #4c97ff; --ink: #243044; --paper: #fffaf0; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background: linear-gradient(180deg, #d7ecff 0%, #fff6d8 100%);
}
.stars { position: fixed; inset: 0; pointer-events: none; }
.wrap { position: relative; z-index: 1; max-width: 900px; margin: 0 auto; padding: 18px 14px 70px; }
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff; border-radius: 22px; padding: 10px 16px;
  box-shadow: 0 8px 0 var(--c); margin-bottom: 16px;
}
.brand { font-weight: 800; font-size: 18px; }
a.back { color: var(--ink); font-weight: 800; text-decoration: none; font-size: 14px; }
.progress-wrap { flex: 1; height: 14px; background: #eee; border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--c); transition: width .3s; }
.score-chip { font-weight: 800; background: #fff3c4; border: 3px solid #f4c430; border-radius: 99px; padding: 4px 10px; }
.card {
  background: var(--paper); border-radius: 26px; padding: 22px;
  box-shadow: 0 10px 0 #ead9b0;
}
h1 { margin: 0 0 8px; font-size: 32px; }
.sub { font-size: 17px; line-height: 1.6; }
.big-btn {
  border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 20px;
  background: var(--c); color: #fff; padding: 12px 24px; border-radius: 16px;
  box-shadow: 0 5px 0 rgba(0,0,0,.2);
}
.big-btn:active { transform: translateY(3px); }
input.name {
  font: inherit; font-size: 20px; padding: 10px 14px; width: min(100%, 300px);
  border-radius: 14px; border: 4px solid var(--c); outline: none;
}
.q-title { font-size: 22px; font-weight: 800; margin: 0 0 8px; }
.hint { color: #5d6478; font-size: 16px; margin-bottom: 10px; }
.hint:empty { display: none; }
.blk-img { height: 44px; width: auto; max-width: 100%; vertical-align: middle; }
.blk-img.wide { height: auto; max-width: min(100%, 520px); border-radius: 10px; }
.blk-stack {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  background: #fff; border-radius: 16px; padding: 12px; margin: 8px 0 14px;
  border: 3px dashed #d7e8ff;
}
.sample { display: flex; flex-wrap: wrap; gap: 8px; background: #fff; border-radius: 16px; padding: 12px; margin-top: 10px; }
.cap { display: block; font-size: 13px; color: #667; font-weight: 700; margin-bottom: 3px; }
.choices { display: grid; gap: 10px; }
.choice {
  text-align: left; cursor: pointer; border: 4px solid #efe4c8; background: #fff;
  border-radius: 16px; padding: 10px 12px; font: inherit; font-size: 17px; font-weight: 700;
  display: flex; gap: 10px; align-items: center; box-shadow: 0 4px 0 #ead9b0;
}
.choice:hover { border-color: var(--c); }
.choice.correct { border-color: #2ecc71; background: #e9ffef; }
.choice.wrong { border-color: #ff6b6b; background: #ffe8e8; }
.choice:disabled { cursor: default; }
.letter {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%;
  background: #ffe08a; display: grid; place-items: center; font-weight: 900;
}
.choice-body { flex: 1; }
.feedback { display: none; margin-top: 14px; padding: 14px; border-radius: 16px; font-size: 17px; font-weight: 700; }
.feedback.show { display: block; }
.feedback.ok { background: #d9ffdf; border: 4px solid #2ecc71; }
.feedback.bad { background: #fff3d6; border: 4px solid #ffb703; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.badge { display: inline-block; background: #ffef9a; border-radius: 99px; padding: 3px 10px; font-weight: 800; }
.level-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 800; padding: 4px 12px; border-radius: 99px; margin-bottom: 10px;
}
.level-tag.lv1 { background: #e6fff2; color: #1a8a5c; }
.level-tag.lv2 { background: #fff3d0; color: #9a6a10; }
.level-tag.lv3 { background: #ffe8e4; color: #c04030; }
.level-tag.lv4 { background: #efe4ff; color: #5b2db3; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 8px; }
@media (min-width: 640px) { .facts { grid-template-columns: 1fr 1fr 1fr 1fr; } }
.fact {
  background: #fff; border-radius: 16px; padding: 12px 10px; text-align: center;
  border: 3px solid #efe4c8;
}
.fact .n { font-size: 20px; font-weight: 800; color: var(--c); }
.fact .t { font-size: 13px; color: #667; margin-top: 2px; font-weight: 700; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 9; }
.overlay {
  display: none; position: fixed; inset: 0; z-index: 8; place-items: center;
  background: rgba(20,30,60,.3); pointer-events: none;
}
.overlay.show { display: grid; }
.stamp {
  background: #fff; border-radius: 24px; padding: 20px; text-align: center;
  transform: scale(.7) rotate(-8deg); animation: pop .4s ease-out forwards;
  box-shadow: 0 16px 40px rgba(0,0,0,.22);
}
.stamp .emoji { font-size: 64px; }
@keyframes pop { to { transform: scale(1) rotate(-2deg); } }
.result-stars { font-size: 38px; }
.tiny { font-size: 14px; color: #667; }
@media (max-width: 700px) { h1 { font-size: 26px; } .blk-img { height: 36px; } }
