/* ============================================================
 * 符箓兽 · 易经六十四卦闯关
 * 童趣风格 · 移动端优先
 * ============================================================ */

:root {
  --bg: #FFF7E6;
  --card: #FFFFFF;
  --ink: #4A3728;
  --ink-2: #8C7862;
  --ink-3: #B7A38C;
  --line: #F0E3CD;

  --blue: #5BB8F5;
  --blue-d: #2E97DC;
  --green: #6FD35E;
  --green-d: #46B336;
  --orange: #FF7A45;
  --orange-d: #E2542B;
  --gold: #FFC93C;
  --gold-d: #E0A200;
  --red: #FF5A5F;
  --red-d: #DB3B40;
  --purple: #B18CFF;
  --purple-d: #8B60E8;

  --yao-yang: #5A4433;
  --yao-yin: #5A4433;

  --radius: 22px;
  --radius-sm: 16px;
  --shadow-sm: 0 2px 0 rgba(74, 55, 40, .10);
  --shadow-md: 0 4px 0 rgba(74, 55, 40, .13);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC",
               -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 10% 16%, rgba(255, 201, 60, .22) 0 56px, transparent 57px),
    radial-gradient(circle at 90% 6%, rgba(91, 184, 245, .16) 0 46px, transparent 47px),
    radial-gradient(circle at 80% 86%, rgba(111, 211, 94, .15) 0 66px, transparent 67px),
    radial-gradient(circle at 6% 74%, rgba(177, 140, 255, .13) 0 52px, transparent 53px);
  background-attachment: fixed;
  font-size: 16px;
  line-height: 1.6;
  overscroll-behavior-y: none;
}

/* ---------------- 整体骨架 ---------------- */
.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 247, 230, .88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 14px;
}
.brand:active { transform: scale(.96); }
.brand-logo { display: flex; align-items: center; }
.brand-logo .lion { display: block; }
.brand-name {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--orange-d);
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  border: none;
  background: #fff;
  border-radius: 14px;
  width: 40px;
  height: 40px;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--line);
}
.icon-btn:active { transform: translateY(2px); box-shadow: none; }

.screen {
  flex: 1;
  padding: 16px 16px 28px;
  animation: screenIn .28s ease both;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---------------- 页脚 ---------------- */
.footer {
  padding: 18px 16px 22px;
  text-align: center;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.9;
  border-top: 1px solid var(--line);
}
.footer a {
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px dotted var(--ink-3);
}
.footer a:hover { color: var(--orange-d); }

.footer-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 9px;
  margin-top: 5px;
}
.footer-sep { color: var(--ink-3); }

/* 404 链接：小小的路牌 */
.f-link-404 {
  border-bottom: none !important;
  background: #F3F6FA;
  color: var(--blue-d) !important;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11.5px;
  font-weight: 800;
  border: 1px solid #DDEAF6;
}
.f-link-404:hover { background: #E4F0FB; }

/* 「闭关中」徽章：睡着的醒狮 + 三个小 Z */
.f-sleep {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: none !important;
  background: #FFF3D6;
  border-radius: 999px;
  padding: 1px 9px 1px 4px;
  font-size: 11.5px;
  font-weight: 800;
  color: #B0842A !important;
  position: relative;
  transition: transform .16s ease, background .16s;
}
.f-sleep:hover { background: #FFEBB8; transform: translateY(-1px); }
.f-sleep .lion-sleep { display: block; }
/* 飘在睡狮头顶的那个小 z */
.f-sleep .zzz {
  position: absolute;
  left: 17px;
  top: -10px;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  color: var(--gold-d);
  line-height: 1;
  animation: zzzFloat 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes zzzFloat {
  0%   { opacity: 0; transform: translateY(3px) scale(.7); }
  35%  { opacity: 1; transform: translateY(-2px) scale(1); }
  100% { opacity: 0; transform: translateY(-9px) scale(1.1); }
}

/* ---------------- 404 页 ---------------- */
.nf {
  text-align: center;
  padding: 12px 0 8px;
}
.nf-num {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 68px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 2px;
  color: var(--orange);
  text-shadow: 0 5px 0 rgba(226, 84, 43, .18);
}
.nf-num .lion-sleep {
  display: block;
  margin: 6px 2px 0;
  animation: breathe 3.4s ease-in-out infinite;
  transform-origin: 50% 80%;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.055) translateY(-1px); }
}
.nf-title { font-size: 22px; font-weight: 900; margin: 6px 0 6px; color: var(--ink); }
.nf-sub { color: var(--ink-2); font-size: 14px; margin: 0 0 4px; line-height: 1.85; }
.nf-tip {
  display: inline-block;
  background: #FFF3D6;
  color: var(--gold-d);
  border-radius: 999px;
  padding: 4px 13px;
  font-size: 13px;
  font-weight: 800;
  margin-top: 12px;
}
.nf-actions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.nf-slip { animation: nfSlip .5s cubic-bezier(.2, .9, .3, 1.3) both; }

/* 「随便摇一卦」的结果卡 */
.nf-gua { text-align: center; padding: 4px 0 2px; }
.nf-gua-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.nf-gua-name { font-size: 22px; font-weight: 900; color: var(--orange-d); }
.nf-gua-full { font-size: 13px; color: var(--ink-3); font-weight: 800; }
.nf-gua-text {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.85;
  margin: 10px 0 0;
  text-align: left;
  background: var(--bg);
  border-radius: 14px;
  padding: 10px 13px;
}
.nf-gua-text b { color: var(--orange-d); }

@media (max-width: 380px) {
  .nf-num { font-size: 56px; }
  .nf-num .lion-sleep { width: 74px !important; height: 47px !important; }
}

/* ---------------- 通用组件 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--line);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 18px;
  padding: 14px 22px;
  font-size: 17px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease, filter .15s;
  color: #fff;
  background: var(--green);
  box-shadow: 0 4px 0 var(--green-d);
}
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--green-d); }
.btn[disabled] { opacity: .45; pointer-events: none; }

.btn-primary { background: var(--green); box-shadow: 0 4px 0 var(--green-d); }
.btn-blue    { background: var(--blue);  box-shadow: 0 4px 0 var(--blue-d); }
.btn-gold    { background: var(--gold);  box-shadow: 0 4px 0 var(--gold-d); color: #6B4A00; }
.btn-orange  { background: var(--orange); box-shadow: 0 4px 0 var(--orange-d); }
.btn-purple  { background: var(--purple); box-shadow: 0 4px 0 var(--purple-d); }
.btn-ghost {
  background: #fff;
  color: var(--ink-2);
  box-shadow: 0 3px 0 var(--line);
  border: 2px solid var(--line);
}
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 9px 16px; font-size: 15px; border-radius: 14px; }

.title-xl { font-size: 26px; font-weight: 900; margin: 0 0 6px; letter-spacing: 1px; }
.title-lg { font-size: 21px; font-weight: 900; margin: 0 0 10px; }
.sub { color: var(--ink-2); font-size: 14.5px; margin: 0 0 14px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #FFF3D6;
  color: var(--gold-d);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13.5px;
  font-weight: 800;
}

.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; }
.center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ---------------- 首页 ---------------- */
.hero {
  text-align: center;
  padding: 4px 0 18px;
}
.hero-lion { display: flex; justify-content: center; margin-bottom: 6px; animation: floatY 3.2s ease-in-out infinite; }
.hero-lion .lion { width: 108px; height: 108px; }
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
.hero-title { font-size: 27px; font-weight: 900; letter-spacing: 3px; color: var(--orange-d); margin: 0; }
.hero-sub { color: var(--ink-2); font-size: 14px; margin: 6px 0 0; }

/* ---- 顶部计分（多邻国式）：常在顶栏，不再占首页版面 ---- */
.topstats { display: flex; align-items: center; gap: 6px; }
.topstat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid var(--line);
  box-shadow: 0 2px 0 rgba(74, 55, 40, .08);
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.5;
  color: var(--ink);
  white-space: nowrap;
}
.topstat .ts-ico { font-size: 13px; line-height: 1; }
.topstat .ts-sub { font-size: 11px; font-weight: 800; color: var(--ink-3); }
.topstat-btn { cursor: pointer; }
.topstat-btn:active { transform: translateY(2px); box-shadow: none; }

/* ---- 首页三张入口图：圆角矩形并排 ---- */
.gate-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);   /* 三张并排，永远等宽 */
  gap: 10px;
  margin: 2px 0 22px;
}
.gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;                            /* 关键：不加这句 grid 子项会被内容撑破 */
  padding: 9px 6px 10px;
  background: #fff;
  border: 3px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 0 rgba(74, 55, 40, .10);
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  text-decoration: none;
  transition: transform .08s, box-shadow .08s;
}
.gate:active { transform: translateY(4px); box-shadow: none; }
.gate.g1 { border-color: #FFE2B8; }
.gate.g2 { border-color: #CDEAFB; }
.gate.g3 { border-color: #D8F3D1; }

/* 图区：正方形，三张图各自缩放居中，视觉重量才一致 */
.gate-art {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 5px;
  background: #FFFBF0;
  border-radius: 12px;
  overflow: hidden;
}
.gate.g2 .gate-art { background: #F2FAFF; }
.gate.g3 .gate-art { background: #FDF7EA; }   /* 实验室那张：暖米底，才衬得出米白的小家伙 */
.gate-art svg { display: block; width: 100%; height: 100%; }

.gate-name {
  font-size: 12.5px;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: .2px;
  text-align: center;
  word-break: break-word;
}

/* ---- 首页的「六十四卦闯关」区块 ---- */
.home-sec { margin-top: 2px; }
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.sec-title { font-size: 17px; font-weight: 900; }
.sec-note { font-size: 12.5px; color: var(--ink-2); flex: none; }

.stat-strip {
  display: flex;
  gap: 10px;
  margin: 14px 0 18px;
}
.stat-box {
  flex: 1;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-num { font-size: 20px; font-weight: 900; color: var(--gold-d); line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--ink-2); }

.stage-list { display: flex; flex-direction: column; gap: 12px; }

.stage-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(74, 55, 40, .10);
  transition: transform .08s, box-shadow .08s;
}
.stage-card:active { transform: translateY(4px); box-shadow: none; }
.stage-card.s1 { border-color: #CDEAFB; }
.stage-card.s2 { border-color: #D8F3D1; }
.stage-card.s3 { border-color: #EADFFB; }
.stage-card.locked { opacity: .62; filter: saturate(.5); }

.stage-emoji {
  width: 54px; height: 54px;
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  flex: none;
}
.s1 .stage-emoji { background: #EAF6FE; }
.s2 .stage-emoji { background: #EDFAE8; }
.s3 .stage-emoji { background: #F5EFFE; }

.stage-name { font-size: 17.5px; font-weight: 900; margin-bottom: 2px; }
.stage-desc { font-size: 13px; color: var(--ink-2); }
.stage-go { font-size: 22px; color: var(--ink-3); }
.stage-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  padding: 1px 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: 2px;
}
.badge-soon { background: #F3E8FF; color: var(--purple-d); }
.badge-new  { background: #FFEFD8; color: var(--orange-d); }

/* ---------------- 章节列表 ---------------- */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.chapter-item {
  position: relative;
  background: #fff;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(74, 55, 40, .10);
  transition: transform .08s, box-shadow .08s;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.chapter-item:active { transform: translateY(4px); box-shadow: none; }
.chapter-item.done { border-color: #CBEBC0; background: #FBFFFA; }
.chapter-item.locked { opacity: .58; filter: saturate(.35); cursor: not-allowed; }
.chapter-no { font-size: 12.5px; font-weight: 800; color: var(--ink-3); letter-spacing: 1px; }
.chapter-name { font-size: 16px; font-weight: 900; margin: 4px 0 2px; }
.chapter-range { font-size: 12.5px; color: var(--ink-2); }
.chapter-item .lock { position: absolute; right: 10px; top: 10px; font-size: 17px; }

/* ---------------- 星 ---------------- */
.stars { display: inline-flex; gap: 2px; }
.star { font-size: 15px; color: #E4D8C4; }
.star.on { color: var(--gold); text-shadow: 0 1px 0 rgba(224, 162, 0, .5); }

/* ---------------- 答题界面 ---------------- */
.quizbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.quizbar-close {
  border: none; background: #fff; border-radius: 12px;
  width: 36px; height: 36px; font-size: 17px; cursor: pointer;
  border: 2px solid var(--line); color: var(--ink-2); flex: none;
}
.progress {
  flex: 1;
  height: 16px;
  background: #F3E8D5;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 2px 3px rgba(74, 55, 40, .08);
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--green));
  transition: width .35s cubic-bezier(.3, 1.4, .5, 1);
}
.quizbar-num { font-size: 13px; font-weight: 800; color: var(--ink-2); flex: none; }

.combo-flame {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, #FFE28A, #FFB03A);
  color: #8A4B00;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 900;
  font-size: 14px;
  box-shadow: 0 3px 0 #E09A20;
  flex: none;
}

.q-card {
  background: #fff;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  text-align: center;
}
.q-type {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--blue-d);
  background: #EAF6FE;
  border-radius: 999px;
  padding: 3px 12px;
  margin-bottom: 10px;
}
.q-ask { font-size: 18px; font-weight: 900; line-height: 1.5; }
.q-ask em { color: var(--orange-d); font-style: normal; }

.tri-svg { flex: none; }

.gua-big .gua-svg { width: 118px; height: auto; margin: 4px auto 0; display: block; }
.gua-mid .gua-svg { width: 86px; height: auto; }
.gua-opt .gua-svg { width: 76px; height: auto; }

.trigram-pair {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-top: 10px;
}
.trigram-pair .tp { text-align: center; }
.trigram-pair .tp-name { font-size: 15px; font-weight: 900; margin-top: 2px; }
.trigram-pair .tp-tag { font-size: 11.5px; color: var(--ink-3); }

/* 选项 */
.options {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding-bottom: 6px;
}
.options.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.option {
  position: relative;
  width: 100%;
  background: #fff;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(74, 55, 40, .10);
  transition: transform .08s, box-shadow .08s, border-color .18s, background .18s;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 58px;
}
.option:active { transform: translateY(4px); box-shadow: none; }
.option .opt-sub { font-size: 12.5px; color: var(--ink-3); font-weight: 700; }
.option.gua-opt { flex-direction: column; gap: 4px; padding: 12px 8px; }

.option.correct {
  border-color: var(--green);
  background: #EDFBE6;
  box-shadow: 0 4px 0 var(--green-d);
}
.option.wrong {
  border-color: var(--red);
  background: #FFEDED;
  box-shadow: 0 4px 0 var(--red-d);
}
.option.dim { opacity: .5; }
.option[disabled] { pointer-events: none; }

/* 拖拽拼爻 */
.drag-area { text-align: center; }
.slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  margin: 12px 0 18px;
}
.slot {
  width: 168px;
  height: 30px;
  border-radius: 12px;
  border: 3px dashed #DCCBB0;
  background: #FFFBF2;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .12s;
}
.slot .mini-holder { display: flex; align-items: center; justify-content: center; }
.slot.over { border-color: var(--blue); background: #EAF6FE; transform: scale(1.03); }
.slot.filled { border-style: solid; border-color: #E8D8BE; background: #fff; }
.slot .pos { font-size: 11px; color: var(--ink-3); margin-right: 8px; }

.drag-tray {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 4px;
}
.drag-chip {
  width: 118px;
  padding: 12px 0;
  border-radius: 16px;
  background: #fff;
  border: 3px solid var(--line);
  box-shadow: 0 4px 0 rgba(74, 55, 40, .10);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
}
.drag-chip:active { cursor: grabbing; }
.drag-chip > span { display: flex; align-items: center; }

.node {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.1);
  opacity: .95;
}

/* ---------------- 反馈条 ---------------- */
.feedback {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: #EAFBE4;
  border-top: 3px solid #C8EBB9;
  animation: fbUp .3s cubic-bezier(.2, 1.2, .4, 1) both;
}
.feedback.bad {
  background: #FFEDED;
  border-top-color: #FFC7C9;
}
@keyframes fbUp {
  from { transform: translateY(100%); }
  to   { transform: none; }
}
.feedback-inner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  max-width: 520px;
  margin: 0 auto 12px;
}
.feedback-icon { font-size: 30px; line-height: 1.1; flex: none; }
.feedback-title { font-size: 18px; font-weight: 900; color: #2E7D1C; }
.feedback.bad .feedback-title { color: var(--red-d); }
.feedback-detail { font-size: 14.5px; color: var(--ink); margin-top: 4px; line-height: 1.65; }
.feedback-detail .hl { color: var(--orange-d); font-weight: 900; }
.feedback-btn { width: 100%; max-width: 520px; margin: 0 auto; display: flex; }

/* 答错时正确答案里的小六爻图 */
.mini-gua { vertical-align: middle; }
.mini-gua .gua-svg { width: 40px; height: auto; display: inline-block; vertical-align: middle; }

/* ---------------- 结算 ---------------- */
.result-card { text-align: center; padding: 26px 18px; }
.result-lion { display: flex; justify-content: center; margin-bottom: 4px; }
.result-lion .lion { width: 96px; height: 96px; }
.result-title { font-size: 24px; font-weight: 900; color: var(--orange-d); margin: 6px 0 4px; }
.result-stars { font-size: 34px; letter-spacing: 6px; margin: 8px 0; }
.result-stars .star { font-size: 34px; }
.result-line { color: var(--ink-2); font-size: 14.5px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0 6px;
}
.stat-grid .stat-box { padding: 12px 4px; }

/* ---------------- 错题本 ---------------- */
.wb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.wb-item .gua-svg { width: 46px; height: auto; flex: none; }
.wb-info { flex: 1; min-width: 0; }
.wb-name { font-size: 16px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-meta { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex: none;
}
.wb-count {
  background: #FFEDED; color: var(--red-d);
  border-radius: 999px; padding: 2px 10px;
  font-size: 12.5px; font-weight: 800;
}
.wb-state { font-size: 11.5px; color: var(--ink-3); font-weight: 700; }
.wb-state.ok { color: var(--green-d); }

/* ---------------- 弹窗 / 提示 ---------------- */
.modal-layer, .toast-layer, .fx-layer {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 200;
}
.modal-layer { z-index: 300; }
.toast-layer { z-index: 250; display: flex; align-items: flex-start; justify-content: center; padding-top: 74px; }

.modal-layer.show { pointer-events: auto; }
.modal-mask {
  width: 100%; height: 100%;
  background: rgba(74, 55, 40, .35);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn .18s both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: #fff;
  border-radius: 26px;
  padding: 24px 20px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(74, 55, 40, .28);
  animation: modalIn .28s cubic-bezier(.2, 1.3, .4, 1) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.86) translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.modal-box .title-lg { margin-bottom: 8px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

.toast {
  background: rgba(74, 55, 40, .92);
  color: #FFF7E6;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 14.5px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .24s, transform .24s;
  max-width: 88vw;
  text-align: center;
}
.toast-layer.show .toast { opacity: 1; transform: none; }

/* ---------------- 特效 ---------------- */
.fx-layer { overflow: hidden; }
.fx-particle {
  position: absolute;
  animation: particleFly .95s cubic-bezier(.15, .9, .4, 1) forwards;
  will-change: transform, opacity;
}
@keyframes particleFly {
  0%   { transform: translate(-50%, -50%) scale(.5) rotate(0deg); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.15) rotate(var(--rot)); opacity: 0; }
}

.fx-rain {
  position: absolute;
  top: -40px;
  animation-name: rainFall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes rainFall {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--sway), 105vh) rotate(420deg); opacity: .1; }
}

.fx-float {
  position: absolute;
  transform: translate(-50%, 0);
  font-size: 20px;
  font-weight: 900;
  color: var(--green-d);
  animation: floatUp 1s ease-out forwards;
  text-shadow: 0 2px 0 rgba(255, 255, 255, .8);
}
@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-50%, 6px) scale(.8); }
  25%  { opacity: 1; transform: translate(-50%, -6px) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -58px) scale(1); }
}

.fx-flash {
  position: fixed; inset: 0;
  z-index: 210;
  pointer-events: none;
  animation: flashOut .5s ease-out forwards;
}
@keyframes flashOut { from { opacity: 1; } to { opacity: 0; } }

.fx-bounce { animation: fxBounce .62s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes fxBounce {
  0%   { transform: scale(1); }
  32%  { transform: scale(1.12) translateY(-7px); }
  62%  { transform: scale(.96) translateY(2px); }
  100% { transform: scale(1); }
}

.fx-shake { animation: fxShake .5s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes fxShake {
  10%, 90% { transform: translateX(-3px); }
  20%, 80% { transform: translateX(5px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}

.fx-pop { animation: fxPop .42s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes fxPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.16); }
  100% { transform: scale(1); }
}

/* 撒星星覆盖层（通关动画） */
.celebrate {
  position: fixed; inset: 0;
  z-index: 220;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.celebrate-badge {
  font-size: 84px;
  animation: celebrateIn .8s cubic-bezier(.2, 1.5, .4, 1) both;
}
@keyframes celebrateIn {
  0%   { transform: scale(0) rotate(-80deg); opacity: 0; }
  55%  { transform: scale(1.18) rotate(8deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* ---------------- 小屏适配 ---------------- */
@media (max-width: 360px) {
  .chapter-grid { gap: 9px; }
  .option { font-size: 16.5px; padding: 13px 12px; }
  .q-ask { font-size: 16.5px; }
  .gua-big .gua-svg { width: 100px; }
  .slot { width: 148px; }
  .drag-chip { width: 104px; }
}

/* ---- 窄屏：顶栏计分和三张入口卡都得收一收，不然挤成一团 ----
   注意：这一段里的选择器全都只出现在首页（.topstat / .gate / .sec-title）。
   特意没去动 .brand-name —— 它是全站公用的，改了会连带影响经穴妙记和 404 页。 */
@media (max-width: 400px) {
  .topstats { gap: 5px; }
  .topstat { padding: 3px 7px; gap: 2px; font-size: 12.5px; }
  .topstat .ts-ico { font-size: 12px; }
  .topstat .ts-sub { font-size: 10.5px; }
  .gate-row { gap: 8px; }
  .gate { padding: 7px 5px 8px; border-width: 2.5px; }
  .gate-name { font-size: 11.5px; }
  .sec-title { font-size: 16px; }
}
