/* ============================================================
   汉字星图 · 毛玻璃双主题
   日间「云梦学堂」：浅梦幻粉紫
   夜间「暮色星河」：深空蓝紫
   ============================================================ */

:root, body[data-theme="day"] {
  --bg-grad: linear-gradient(135deg, #f7e8fb 0%, #ece4fa 38%, #fdeaf3 72%, #f6e9fb 100%);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --glass-border: rgba(255, 255, 255, 0.9);
  --glass-shadow: 0 8px 32px rgba(167, 139, 250, 0.16);
  --text-main: #3d3554;
  --text-sub: #7a6f96;
  --accent: #a78bfa;
  --accent-deep: #8b5cf6;
  --accent-2: #f0a6ca;
  --accent-2-deep: #e879a9;
  --gold: #f5b942;
  --danger: #e8607a;
  --danger-soft: #fdeef2;
  --ok: #4fb286;
  --chip-bg: rgba(167, 139, 250, 0.14);
  --chip-text: #7c5cd6;
  --char-card-bg: rgba(255, 255, 255, 0.78);
  --char-hover: rgba(167, 139, 250, 0.22);
  --sky-bg: radial-gradient(ellipse at 50% 20%, #fdf1f9 0%, #efe7fa 55%, #e5dcf7 100%);
  --star-fill: #8b6fe8;
  --star-stroke: #6a4fd0;
  --line-color: rgba(139, 111, 232, 0.38);
  --scroll-thumb: rgba(167, 139, 250, 0.35);
  --mascot-bubble: rgba(255, 255, 255, 0.85);
}

body[data-theme="night"] {
  --bg-grad: linear-gradient(135deg, #141432 0%, #1c1a44 40%, #251a4e 75%, #141432 100%);
  --glass: rgba(38, 34, 74, 0.72);
  --glass-strong: rgba(30, 27, 60, 0.9);
  --glass-border: rgba(184, 166, 245, 0.22);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --text-main: #ece7ff;
  --text-sub: #a89ede;
  --accent: #b8a6f5;
  --accent-deep: #9d82f0;
  --accent-2: #f2a5c8;
  --accent-2-deep: #e884b3;
  --gold: #f5c869;
  --danger: #f0708f;
  --danger-soft: rgba(240, 112, 143, 0.14);
  --ok: #6ecfa4;
  --chip-bg: rgba(184, 166, 245, 0.18);
  --chip-text: #cabcf8;
  --char-card-bg: rgba(46, 42, 88, 0.72);
  --char-hover: rgba(184, 166, 245, 0.3);
  --sky-bg: radial-gradient(ellipse at 50% 15%, #23204d 0%, #1a1740 50%, #12102c 100%);
  --star-fill: #d5c9ff;
  --star-stroke: #b3a1f2;
  --line-color: rgba(184, 166, 245, 0.34);
  --scroll-thumb: rgba(184, 166, 245, 0.35);
  --mascot-bubble: rgba(52, 47, 96, 0.85);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  background: var(--bg-grad) fixed;
  color: var(--text-main);
  transition: background 0.6s ease, color 0.4s ease;
  overflow: hidden;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.glass-strong {
  background: var(--glass-strong);
  backdrop-filter: blur(28px) saturate(1.5);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  border: 1px solid var(--glass-border);
  box-shadow: 0 18px 60px rgba(90, 60, 160, 0.28);
}

.icon { width: 20px; height: 20px; display: inline-block; vertical-align: -4px; }
.hidden { display: none !important; }

/* ============ 顶栏 ============ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 64px;
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px;
  border-left: 0; border-right: 0; border-top: 0;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }
.brand-text h1 { font-size: 20px; letter-spacing: 1px; }
.brand-sub { font-size: 11px; color: var(--text-sub); }

.module-tabs { display: flex; gap: 8px; margin-left: 12px; }
.tab {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 999px;
  border: 1px solid transparent; background: transparent;
  color: var(--text-sub); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.25s;
  font-family: inherit;
}
.tab:hover { background: var(--chip-bg); color: var(--text-main); }
.tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35);
}
.tab .icon { width: 18px; height: 18px; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.theme-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--glass-border); background: var(--chip-bg);
  color: var(--text-main); font-size: 13px; font-weight: 600;
  font-family: inherit; transition: all 0.25s;
}
.theme-toggle:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(139,92,246,.25); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline-block; }
body[data-theme="night"] .theme-toggle .icon-sun { display: inline-block; }
body[data-theme="night"] .theme-toggle .icon-moon { display: none; }
.theme-label { font-size: 13px; }

/* 键盘可达性：统一焦点环 */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ============ 模块布局 ============ */
.module { display: none; position: fixed; inset: 64px 0 0 0; }
.module.active { display: flex; }

/* ============ 生字课本 ============ */
#module-book { gap: 16px; padding: 16px; }

.sidebar {
  width: 280px; flex-shrink: 0; border-radius: 22px;
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-head { padding: 18px 20px 12px; }
.sidebar-head h2 { font-size: 18px; }
.sidebar-sub { font-size: 12px; color: var(--text-sub); }
.tree { flex: 1; overflow-y: auto; padding: 6px 12px 18px; }

.unit-block { margin-bottom: 8px; }
.unit-head {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border: none; border-radius: 14px;
  background: transparent; color: var(--text-main);
  font-size: 15px; font-weight: 700; cursor: pointer; text-align: left;
  font-family: inherit; transition: background 0.2s;
}
.unit-head:hover { background: var(--chip-bg); }
.unit-head .caret { margin-left: auto; transition: transform 0.25s; font-size: 12px; color: var(--text-sub); }
.unit-block.open .caret { transform: rotate(90deg); }
.unit-no {
  width: 26px; height: 26px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 13px; font-weight: 700;
}
.unit-lessons { display: none; padding: 2px 4px 4px 10px; }
.unit-block.open .unit-lessons { display: block; }
.lesson-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 10px; margin: 2px 0;
  border: none; border-radius: 12px; background: transparent;
  color: var(--text-sub); font-size: 14px; cursor: pointer; text-align: left;
  font-family: inherit; transition: all 0.2s;
}
.lesson-item:hover { background: var(--chip-bg); color: var(--text-main); }
.lesson-item.active {
  background: linear-gradient(135deg, rgba(167,139,250,.28), rgba(240,166,202,.28));
  color: var(--text-main); font-weight: 700;
}
.lesson-item .count { margin-left: auto; font-size: 11px; color: var(--text-sub); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; overflow: hidden; }
.content-head { border-radius: 22px; padding: 16px 22px; }
.content-head h2 { font-size: 22px; margin-bottom: 4px; }
.lesson-meta { font-size: 13px; color: var(--text-sub); }
.lesson-meta .chip {
  display: inline-block; padding: 2px 10px; margin-right: 8px; border-radius: 999px;
  background: var(--chip-bg); color: var(--chip-text); font-size: 12px; font-weight: 600;
}

.mascot-tip { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.mascot-avatar {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  border: 2px solid var(--glass-border); box-shadow: 0 4px 14px rgba(240,166,202,.35);
}
.mascot-say {
  font-size: 13.5px; line-height: 1.65; color: var(--text-main);
  background: var(--mascot-bubble); border-radius: 4px 16px 16px 16px;
  padding: 9px 14px; max-width: 560px;
}

.char-grid {
  flex: 1; overflow-y: auto; border-radius: 22px; padding: 18px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 14px; align-content: start;
}
.char-card {
  aspect-ratio: 1; border-radius: 20px; border: 1px solid var(--glass-border);
  background: var(--char-card-bg); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; transition: all 0.22s; position: relative;
}
.char-card:hover { transform: translateY(-4px) scale(1.03); background: var(--char-hover); box-shadow: 0 10px 24px rgba(139,92,246,.25); }
.char-card .glyph {
  font-family: KaiTi, "楷体", STKaiti, serif; font-size: 44px; line-height: 1.1;
  color: var(--text-main); font-weight: 700;
}
.char-card .py { font-size: 12.5px; color: var(--accent-deep); font-weight: 600; }
.char-card .badge {
  position: absolute; top: 8px; right: 9px; font-size: 10px; padding: 1px 7px;
  border-radius: 999px; background: var(--chip-bg); color: var(--chip-text); font-weight: 700;
}
.char-card .trap-dot {
  position: absolute; top: 8px; left: 9px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); box-shadow: 0 0 6px rgba(232,96,122,.6);
}
/* 生字网格的板块标题：写字表 / 识字表 各一段 */
.grid-sec-head {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; font-weight: 700; color: var(--accent-deep);
  padding: 6px 2px 0;
}
.grid-sec-head::after { content: ""; flex: 1; height: 1px; background: var(--glass-border); }

/* ============ 四幕翻幕字卡 ============ */
.card-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(30, 20, 55, 0.4);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.flipcard {
  /* PC 上加宽：高分屏（1920/2560）两侧不再留大片空白；手机上由媒体查询收回全宽 */
  width: min(1840px, 93vw); height: min(940px, calc(100vh - 48px));
  border-radius: 28px; position: relative;
  display: flex; flex-direction: column; overflow: hidden;
  animation: popIn 0.32s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.card-close {
  position: absolute; top: 14px; right: 14px; z-index: 5;
  width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--chip-bg); color: var(--text-sub);
  display: flex; align-items: center; justify-content: center; transition: all .2s;
}
.card-close:hover { background: var(--danger); color: #fff; transform: rotate(90deg); }

.card-progress {
  height: 5px; margin: 16px 22px 0; border-radius: 999px; background: var(--chip-bg);
  overflow: hidden;
}
.card-progress .bar {
  height: 100%; border-radius: 999px; width: 25%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s cubic-bezier(.4,0,.2,1);
}

.card-stage { flex: 1; min-width: 0; padding: 18px 30px 10px; overflow-y: auto; position: relative; }
.scene { animation: sceneIn 0.38s cubic-bezier(.25,1,.4,1); }
@keyframes sceneIn { from { transform: translateX(36px); opacity: 0; } to { transform: none; opacity: 1; } }

.scene-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: var(--accent-deep); margin-bottom: 12px;
}
.scene-title .icon { width: 18px; height: 18px; }

.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; margin-top: 10px; }

/* ---------- 第四幕 · 星空考验（考题出现时隐藏左栏，防止边考边看） ---------- */
.card-body.quiz-mode .card-aside { display: none; }

.quiz-box {
  background: var(--char-card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 18px; padding: 20px 22px; margin-top: 14px;
  box-shadow: var(--glass-shadow);
}
.quiz-q { font-size: 16.5px; line-height: 1.65; color: var(--text-main); }
.quiz-hint {
  color: var(--accent-deep); font-size: 18px; letter-spacing: .5px;
  background: var(--chip-bg); border: 1px solid var(--glass-border);
  border-radius: 10px; padding: 3px 10px; margin-right: 4px; white-space: nowrap;
}
.quiz-opts { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.quiz-opt {
  font-family: inherit; font-size: 15.5px; line-height: 1.5; text-align: left;
  color: var(--text-main); cursor: pointer;
  background: var(--chip-bg); border: 1.5px solid var(--glass-border);
  border-radius: 14px; padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.quiz-opt:hover { transform: translateY(-2px); border-color: var(--accent); }
.quiz-opt .tick {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--glass-border); background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; color: transparent; transition: all .15s ease;
}
.quiz-opt.is-ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.quiz-opt.is-ok .tick { border-color: var(--ok); }
.quiz-opt.is-ok.picked .tick { background: var(--ok); color: #fff; }
.quiz-opt.is-ok.picked .tick::after { content: "✓"; }
.quiz-opt.is-bad { border-color: var(--danger); background: var(--danger-soft); }
.quiz-opt.is-bad .tick { border-color: var(--danger); }
.quiz-opt.is-bad.nope { animation: shake .4s ease; }
.quiz-opt.is-bad.nope .tick::after { content: "✗"; color: var(--danger); }
.quiz-opt:disabled { cursor: default; opacity: .8; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); } 75% { transform: translateX(6px); }
}
.quiz-msg { margin-top: 14px; }
.qm { border-radius: 12px; padding: 11px 14px; font-size: 14.5px; line-height: 1.6; }
.qm-ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent); }
.qm-bad { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.quiz-next {
  font-family: inherit; font-size: 14.5px; cursor: pointer; margin-top: 10px;
  color: #fff; background: linear-gradient(135deg, var(--accent-deep), var(--accent-2-deep));
  border: none; border-radius: 999px; padding: 9px 22px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.quiz-next:hover { transform: translateY(-1px); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent-deep) 40%, transparent); }
.quiz-pass { text-align: center; padding: 18px; }
.quiz-pass .pass-star { font-size: 26px; letter-spacing: 6px; }
.quiz-pass .pass-line { font-size: 16px; margin-top: 8px; }
.quiz-pass .pass-sub { color: var(--text-sub); font-size: 13px; margin-top: 4px; }
#quizMore { margin-top: 12px; }

/* ---- 课程级星空考验：生字表下方的测验入口 + 弹层 ---- */
.lesson-quiz-entry { grid-column: 1 / -1; margin-top: 14px; text-align: center; }
.lq-entry-btn {
  font-family: inherit; cursor: pointer;
  font-size: 16px; font-weight: 600; color: var(--text-main);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent),
                                         color-mix(in srgb, var(--accent-2) 14%, transparent));
  border: 1.5px solid color-mix(in srgb, var(--accent-deep) 35%, transparent);
  border-radius: 16px; padding: 13px 26px;
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
.lq-entry-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px color-mix(in srgb, var(--accent-deep) 25%, transparent); }
.lq-entry-btn .lq-star { color: var(--accent-deep); font-size: 18px; }
.lq-entry-btn .lq-sub { font-size: 12.5px; font-weight: 400; color: var(--text-sub); }
.lesson-quiz-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: color-mix(in srgb, var(--bg-deep, #3a2f55) 45%, rgba(60, 40, 90, .35));
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.lesson-quiz-overlay.hidden { display: none; }
.lq-panel {
  position: relative; width: min(680px, 94vw); max-height: min(86vh, 820px);
  overflow-y: auto; border-radius: 22px; padding: 26px 26px 22px;
}
.lq-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.lq-tag {
  font-size: 12.5px; color: var(--accent-deep);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-deep) 30%, transparent);
  border-radius: 999px; padding: 3px 12px;
}
.lq-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.lq-actions .quiz-next { margin-top: 6px; }
.quiz-next.lq-ghost {
  color: var(--text-main);
  background: transparent; border: 1.5px solid var(--glass-border);
}
@media (max-width: 640px) {
  .lq-panel { padding: 20px 16px 16px; }
  .lq-entry-btn { font-size: 14.5px; padding: 11px 18px; }
}

/* ---- 造字的方法：标签强调 + 一句描述（怎么形声/怎么会意） ---- */
.etym-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 10px; }
.etym-tag {
  flex: none; padding: 4px 14px; border-radius: 999px;
  font-size: 14px; font-weight: 700; color: #fff; letter-spacing: 1px;
  background: linear-gradient(135deg, #b79df5, #8f6fe0);
  box-shadow: 0 3px 10px rgba(143, 111, 224, .35);
}
.etym-tag.t-会意 { background: linear-gradient(135deg, #63d8c2, #2fae9b);
  box-shadow: 0 3px 10px rgba(47, 174, 155, .35); }
.etym-tag.t-象形 { background: linear-gradient(135deg, #f8c064, #eb9b3f);
  box-shadow: 0 3px 10px rgba(235, 155, 63, .35); }
.etym-tag.t-指事 { background: linear-gradient(135deg, #f191b2, #e06c96);
  box-shadow: 0 3px 10px rgba(224, 108, 150, .35); }
.etym-desc { font-size: 13.5px; line-height: 1.7; color: var(--text-sub); padding-top: 3px; }

/* ---- 词语板块：词语表的词优先并带角标，其余是表外常用词 ---- */
.word-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.word-chip {
  position: relative; padding: 5px 12px; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; line-height: 1.4;
  background: var(--chip-bg); border: 1px solid var(--glass-border); color: var(--text-main);
}
.word-chip.book { background: #fff; border-color: var(--accent); color: var(--accent-deep); }
.word-chip.book i {
  font-style: normal; font-size: 10px; font-weight: 700; margin-left: 5px;
  padding: 1px 5px; border-radius: 999px; vertical-align: 1px;
  background: var(--accent); color: #fff; opacity: .85;
}

/* ---- 字卡左栏：大字 / 拼音 / 小档案 / 拆解，从第一幕到第四幕一直在左边 ---- */
.card-body { flex: 1; display: flex; min-height: 0; }
.card-aside {
  flex: 0 0 clamp(304px, 19.5%, 400px); width: clamp(304px, 19.5%, 400px);
  display: flex; flex-direction: column; gap: 14px;
  padding: 22px 20px 14px; overflow-y: auto;
  border-right: 1px dashed var(--glass-border);
  background: linear-gradient(180deg, var(--chip-bg), transparent 55%);
}

/* ---- 田字格（左边大楷体 + 第一幕笔顺动画共用） ---- */
.tz-box {
  --tz: clamp(158px, 20vh, 250px);
  position: relative; margin: 0 auto;
  width: var(--tz); height: var(--tz); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 14px;
  box-shadow: 0 6px 20px rgba(139, 92, 246, .16), inset 0 0 0 1px rgba(167, 139, 250, .18);
}
.tz-grid { position: absolute; inset: 0; width: 100%; height: 100%; }
.tz-grid .tzg-frame {
  fill: none; stroke: #e9a2b8; stroke-width: 1; vector-effect: non-scaling-stroke;
}
.tz-grid .tzg-mid {
  stroke: #f2bcce; stroke-width: .8; stroke-dasharray: 3.4 2.6;
  vector-effect: non-scaling-stroke;
}
.tz-box > .big { position: relative; color: #2b2440; }

.aside-hero { text-align: center; padding: 2px 0 4px; }
.aside-hero .pinyin {
  font-size: 24px; color: var(--accent-deep); font-weight: 700; letter-spacing: 2px;
  margin-bottom: 8px;
}
.aside-hero .big {
  font-family: KaiTi, "楷体", STKaiti, serif; font-size: calc(var(--tz, 200px) * .8);
  line-height: 1; color: #2b2440; font-weight: 700;
}
.aside-extra { display: flex; flex-direction: column; gap: 12px; }
.card-aside .decomp-part { min-width: 74px; padding: 8px 8px; }
.card-aside .decomp-part .g { font-size: 30px; }
.meet-info-mobile { display: none; }   /* PC 上信息都在左栏，这里不重复 */

/* ---- 笔顺演示 ---- */
.stroke-demo { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.sd-svg {
  width: 100%; max-width: clamp(300px, 52vh, 560px); aspect-ratio: 1 / 1;
  background: #fff; border-radius: 16px; border: 1px solid var(--glass-border);
}
.sd-svg .tzg-frame {
  fill: none; stroke: #e9a2b8; stroke-width: 8;
}
.sd-svg .tzg-mid {
  stroke: #f2bcce; stroke-width: 6; stroke-dasharray: 34 26;
}
.sd-svg .sd-p { transition: opacity .16s ease; }
.sd-bar { display: flex; align-items: center; gap: 12px; }
.sd-count { font-size: 12.5px; color: var(--text-sub); font-weight: 600; }
.sd-replay { padding: 5px 12px; font-size: 12.5px; }
.info-block {
  background: var(--char-card-bg); border: 1px solid var(--glass-border);
  border-radius: 18px; padding: 14px 16px;
}
.info-label {
  font-size: 12px; font-weight: 700; color: var(--accent-deep);
  letter-spacing: 1px; margin-bottom: 8px;
}
.info-label::before { content: "◆ "; opacity: .6; }
.card-aside .decomp-row { justify-content: flex-start; margin-top: 0; }
.solo-note { color: var(--text-sub); font-size: 13px; }
.chip {
  padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--chip-bg); color: var(--chip-text);
}
.chip.warn { background: var(--danger-soft); color: var(--danger); }

.decomp-row { display: flex; justify-content: center; align-items: stretch; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.decomp-part {
  min-width: 86px; padding: 10px 12px; border-radius: 16px; text-align: center;
  background: var(--char-card-bg); border: 1px solid var(--glass-border);
}
.decomp-part .g { font-family: KaiTi, "楷体", serif; font-size: 34px; font-weight: 700; }
.decomp-part .l { font-size: 11.5px; color: var(--text-sub); margin-top: 2px; }
.decomp-part.meaning { border-color: var(--accent); background: var(--chip-bg); }
.decomp-part.sound { border-color: var(--accent-2); }
.decomp-plus { align-self: center; font-size: 20px; color: var(--text-sub); font-weight: 700; }

.story-box {
  background: var(--char-card-bg); border: 1px solid var(--glass-border);
  border-radius: 18px; padding: 16px 18px; line-height: 1.9; font-size: 15.5px;
}
.story-box .origin-tag { display: inline-block; margin-bottom: 8px; }

/* ---- 回到古代：古汉字字形 ---- */
.ancient-box {
  margin-top: 14px; padding: 14px 16px 12px;
  border-radius: 18px; border: 1px dashed var(--accent);
  background: linear-gradient(180deg, var(--chip-bg), transparent 70%);
}
.ancient-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ancient-head .chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; }
.ancient-head .chip .icon { width: 15px; height: 15px; }
.ancient-sub { font-size: 12.5px; color: var(--text-sub); }

.ancient-track {
  display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 10px;
}
.anc-slot { flex: 1 1 128px; min-width: 118px; text-align: center; }
.anc-frame {
  height: 96px; border-radius: 14px; padding: 6px;
  background: #fff; border: 1px solid var(--glass-border);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
body[data-theme="night"] .anc-frame { background: #231f47; }
.anc-frame img { max-width: 100%; max-height: 100%; object-fit: contain; }
.anc-frame .anc-fallback { display: none; font-size: 11.5px; line-height: 1.5; color: var(--text-sub); }
.anc-slot.img-fail .anc-fallback { display: block; }
.anc-slot.img-fail .anc-frame { border-style: dashed; }

/* 没有古字图：把注释直接写进白框 */
.anc-frame.anc-text span {
  font-size: 12px; line-height: 1.55; color: var(--text-sub);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.anc-frame.anc-now .anc-now-glyph {
  font-family: KaiTi, "楷体", STKaiti, serif; font-size: 46px; font-weight: 700; color: var(--text-main);
}
/* 繁体字槽位：系统楷体直接写繁体，颜色略深以区别于「现在的字」 */
.anc-frame.anc-trad .anc-trad-glyph {
  font-family: KaiTi, "楷体", STKaiti, serif; font-size: 44px; font-weight: 700; color: var(--accent-deep);
}
.anc-era { margin-top: 6px; font-size: 12.5px; font-weight: 700; color: var(--accent-deep); }
.anc-note { margin-top: 2px; font-size: 11.5px; line-height: 1.5; color: var(--text-sub); }

.ancient-note {
  font-size: 13.5px; line-height: 1.8; color: var(--text-main);
  background: var(--char-card-bg); border-radius: 12px; padding: 10px 12px;
}
.ancient-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
  padding: 8px 14px; border-radius: 12px; text-decoration: none;
  font-size: 13px; font-weight: 700; color: var(--accent-deep);
  background: var(--chip-bg); border: 1px solid var(--glass-border); transition: all .2s;
}
.ancient-link .icon { width: 15px; height: 15px; }
.ancient-link:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }
.ancient-credit { margin-top: 8px; font-size: 11px; color: var(--text-sub); opacity: .75; }

.trap-alert {
  border-radius: 18px; padding: 16px 18px;
  background: var(--danger-soft); border: 1.5px dashed var(--danger);
  margin-bottom: 12px;
}
.trap-alert .alarm {
  display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--danger);
  font-size: 14px; margin-bottom: 10px;
}
.trap-alert .wrong-line { font-size: 15px; line-height: 1.7; margin-top: 8px; }
.trap-alert .wrong-line b { color: var(--danger); }
.trap-alert .right-line { font-size: 15px; line-height: 1.7; margin-top: 6px; }
.trap-alert .right-line b { color: var(--ok); }
.scene-count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--text-sub); }

/* 宽屏（≥1400px）：字卡加宽后，小陷阱卡片两列排，省得一路往下滚；第一幕改成两栏 */
.trap-list { display: flex; flex-direction: column; }
.meet-grid { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.meet-side { display: none; }
.write-hint { font-size: 15px; line-height: 1.85; }
.write-sub { font-size: 13px; color: var(--text-sub); margin-top: 10px; line-height: 1.7; }

@media (min-width: 1400px) {
  .trap-list {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px; align-items: start;
  }
  .trap-list .trap-alert { margin-bottom: 0; }
  .cmp-glyph { height: 200px; }
  .cmp { max-width: 260px; }
}

/* 宽屏：第一幕改成「大田字格 + 写字顺序」两栏，别让中间空一大片 */
@media (min-width: 1200px) {
  .meet-grid { flex-direction: row; align-items: center; justify-content: center; gap: clamp(24px, 4vw, 64px); }
  .meet-grid .sd-svg { width: clamp(300px, 30vw, 520px); max-width: none; }
  .meet-side { display: block; flex: 0 1 340px; text-align: left; }
}
@media (min-width: 1500px) {
  .meet-grid .sd-svg { width: clamp(400px, 38vw, 660px); }
  .meet-side { flex: 0 1 400px; }
}

/* ---- 小陷阱：正确 / 错误写法对比图 ---- */
.trap-compare {
  display: flex; align-items: stretch; justify-content: center; gap: 10px;
  background: var(--glass); border-radius: 16px; padding: 12px 10px;
}
.cmp { flex: 1 1 0; min-width: 0; max-width: 210px; text-align: center; }
.cmp-glyph {
  display: flex; align-items: center; justify-content: center;
  height: 152px; border-radius: 14px; background: #fff;
  border: 2px solid var(--glass-border); padding: 6px;
}
.cmp-ok .cmp-glyph { border-color: var(--ok); box-shadow: 0 4px 14px rgba(79,178,134,.22); }
.cmp-bad .cmp-glyph { border-color: var(--danger); box-shadow: 0 4px 14px rgba(232,96,122,.22); }
.cmp-glyph img { width: 100%; height: 100%; object-fit: contain; }
.cmp-tag { font-size: 12.5px; font-weight: 700; margin-top: 8px; }
.cmp-ok .cmp-tag { color: var(--ok); }
.cmp-bad .cmp-tag { color: var(--danger); }
.cmp-vs {
  flex: 0 0 92px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px;
}
.vs-diff {
  font-size: 12px; font-weight: 800; color: #fff; background: var(--danger);
  border-radius: 999px; padding: 4px 10px; line-height: 1.3; text-align: center;
}
.vs-arrow { font-size: 11px; font-weight: 800; color: var(--text-sub); letter-spacing: 1px; }
.cmp-scope { font-size: 12px; color: var(--text-sub); text-align: center; margin-top: 8px; }

/* 字形图片：SVG 笔画图缺失时退回楷体文字 */
.glyph-img { display: inline-block; width: 100%; height: 100%; }
.glyph-img img { width: 100%; height: 100%; object-fit: contain; }
.glyph-img.img-fail::after {
  content: attr(data-fallback);
  display: flex; align-items: center; justify-content: center; height: 100%;
  font-family: KaiTi, "楷体", STKaiti, serif; font-size: 62px; font-weight: 700;
  color: var(--text-main);
}

/* ---- 说文解字 ---- */
.shuowen-box { margin-top: 12px; border-left: 4px solid var(--accent); }
.sw-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.sw-head .origin-tag { background: var(--accent); color: #fff; }
.sw-juan { background: var(--chip-bg); color: var(--chip-text); }
.sw-ref { background: var(--char-hover); color: var(--chip-text); }
.sw-original {
  font-family: KaiTi, "楷体", STKaiti, serif; font-size: 18px; line-height: 1.8;
  color: var(--text-main); letter-spacing: 1px;
  background: var(--chip-bg); border-radius: 12px; padding: 10px 12px;
}
.sw-baihua { font-size: 15px; line-height: 1.9; margin-top: 10px; }
.sw-baihua b { color: var(--accent-deep); }
.sw-note { font-size: 12.5px; color: var(--text-sub); margin-top: 6px; }

.conn-list { display: flex; flex-direction: column; gap: 10px; }
.conn-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: 16px; background: var(--char-card-bg); border: 1px solid var(--glass-border);
  cursor: pointer; transition: all 0.2s; text-align: left; width: 100%;
  border-left: 4px solid var(--accent); font-family: inherit;
}
.conn-item:hover { transform: translateX(4px); background: var(--char-hover); }
.conn-item .t {
  font-family: KaiTi, "楷体", serif; font-size: 30px; font-weight: 700; min-width: 40px;
  color: var(--accent-deep);
}
.conn-item .note { font-size: 14px; line-height: 1.6; color: var(--text-main); }
.conn-item .type-tag {
  margin-left: auto; flex-shrink: 0; font-size: 11px; padding: 2px 9px; border-radius: 999px;
  background: var(--chip-bg); color: var(--chip-text); font-weight: 700;
}
.conn-item.same-root { border-left-color: var(--accent-2-deep); }
.conn-item.shape-confusable { border-left-color: var(--danger); }
.conn-item.antonym { border-left-color: var(--gold); }

.card-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px 16px; gap: 10px;
}
.card-dots { display: flex; gap: 7px; }
.card-dots .dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--chip-bg);
  transition: all 0.25s; cursor: pointer;
}
.card-dots .dot.on { background: var(--accent); transform: scale(1.25); }
.btn-primary, .btn-ghost {
  padding: 10px 20px; border-radius: 14px; cursor: pointer;
  font-size: 14px; font-weight: 700; font-family: inherit; transition: all 0.2s;
}
.btn-primary {
  border: none; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px rgba(139,92,246,.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(139,92,246,.45); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-ghost {
  border: 1.5px solid var(--glass-border); background: transparent; color: var(--text-sub);
}
.btn-ghost:hover { background: var(--chip-bg); color: var(--text-main); }
.card-expand { position: absolute; bottom: 78px; right: 22px; font-size: 12.5px; padding: 7px 14px; }

/* ============ 文字星图 ============ */
#module-sky { flex-direction: column; }
.sky-toolbar {
  margin: 14px 16px 10px; border-radius: 18px; padding: 10px 16px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; z-index: 20;
}
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-label { font-size: 12.5px; color: var(--text-sub); font-weight: 700; white-space: nowrap; }
.filter-select {
  padding: 7px 12px; border-radius: 12px; border: 1px solid var(--glass-border);
  background: var(--char-card-bg); color: var(--text-main); font-size: 13px;
  font-family: inherit; cursor: pointer; outline: none; max-width: 190px;
}
.legend-group { flex-wrap: wrap; gap: 6px; }
.legend-chip {
  display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--glass-border); background: transparent; color: var(--text-sub);
  font-family: inherit; transition: all .2s;
}
.legend-chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-chip.on { background: var(--chip-bg); color: var(--text-main); border-color: currentColor; }

.sky-stage { flex: 1; position: relative; margin: 0 16px 16px; border-radius: 22px; overflow: hidden; background: var(--sky-bg); }
#skyCanvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
#skyCanvas.dragging { cursor: grabbing; }
.sky-mascot {
  position: absolute; top: 14px; left: 14px; max-width: 380px;
  border-radius: 18px; padding: 10px 14px; display: flex; gap: 10px; align-items: center;
  transition: opacity .4s; z-index: 10;
}
.sky-mascot .mascot-avatar { width: 40px; height: 40px; }
.sky-mascot .mascot-say { font-size: 12.5px; padding: 6px 10px; }
.sky-hint {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--text-sub); background: var(--glass);
  padding: 5px 16px; border-radius: 999px; pointer-events: none; z-index: 10;
}

.star-pop {
  position: absolute; z-index: 30; width: 300px; border-radius: 20px; padding: 16px 18px;
  pointer-events: auto; animation: popIn .25s cubic-bezier(.34,1.56,.64,1);
}
.star-pop .sp-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.star-pop .sp-glyph { font-family: KaiTi, "楷体", serif; font-size: 52px; font-weight: 700; line-height: 1.1; }
.star-pop .sp-py { color: var(--accent-deep); font-weight: 700; font-size: 16px; }
.star-pop .sp-badge { margin-left: auto; font-size: 11px; padding: 2px 9px; border-radius: 999px; background: var(--chip-bg); color: var(--chip-text); font-weight: 700; white-space: nowrap; }
.star-pop .sp-body { font-size: 13px; line-height: 1.7; color: var(--text-main); margin: 8px 0 12px; max-height: 150px; overflow-y: auto; }
.star-pop .sp-go {
  width: 100%; padding: 9px; border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  font-size: 13.5px; font-weight: 700; font-family: inherit;
}

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* 响应式 */
@media (max-width: 900px) {
  .sidebar { width: 220px; }
  .brand-sub { display: none; }
  .sky-toolbar { gap: 8px; }
  /* 平板 / 手机：顶部只钉住「拼音 + 小楷体」，小档案等收进第一幕 */
  .card-body { flex-direction: column; }
  .card-aside {
    flex: 0 0 auto; width: auto; flex-direction: row; align-items: center; justify-content: center;
    gap: 14px; padding: 8px 16px; border-right: none;
    border-bottom: 1px solid var(--glass-border);
    background: linear-gradient(90deg, var(--chip-bg), transparent 70%);
  }
  .aside-hero { display: flex; align-items: center; gap: 14px; padding: 0; order: -1; }
  .aside-hero .pinyin { font-size: 20px; letter-spacing: 1px; margin-bottom: 0; }
  .aside-hero .big { font-size: 62px; line-height: 1; }
  /* 手机上顶部只钉拼音 + 小楷体，田字格收掉省地方 */
  .tz-box { width: auto; height: auto; background: none; box-shadow: none; border-radius: 0; }
  .tz-grid { display: none; }
  .aside-extra { display: none; }
  .meet-info-mobile { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
  .flipcard { width: min(720px, calc(100vw - 28px)); height: min(760px, calc(100vh - 70px)); }
  .cmp-glyph { height: 132px; }
  .cmp { max-width: 200px; }
}
@media (max-width: 640px) {
  .sidebar { display: none; }
  .tab span { display: none; }
  .flipcard { width: calc(100vw - 16px); height: calc(100vh - 56px); border-radius: 20px; }
  .card-stage { padding: 14px 16px 8px; }
  .aside-hero .big { font-size: 52px; }
  .aside-hero .pinyin { font-size: 18px; }
  .sd-svg { max-width: 230px; }
  .trap-compare { gap: 6px; padding: 10px 6px; }
  .cmp { max-width: none; }
  .cmp-glyph { height: 104px; padding: 4px; }
  .cmp-vs { flex-basis: 58px; }
  .vs-diff { font-size: 11px; padding: 3px 7px; }
  .glyph-img.img-fail::after { font-size: 40px; }
  .sw-original { font-size: 16px; }
}
