/* ═══════════════ 学中文 · 识字乐园 ═══════════════ */

:root {
  --bg: #FFF6E9;
  --card: #FFFFFF;
  --ink: #3D3229;
  --ink-2: #8A7A6B;
  --accent: #FF8A3D;
  --accent-soft: #FFE3CC;
  --green: #15803D;
  --green-soft: #DCF3E4;
  --amber: #F5A623;
  --amber-soft: #FDEBC8;
  --gray-cell: #EFE9DE;
  --red: #E2554B;
  --shadow: 0 4px 14px rgba(120, 90, 40, .12);
  --radius: 20px;
  --hanzi-font: "Kaiti SC", "STKaiti", "KaiTi", "Noto Serif SC", serif;
}
body.user-toby   { --accent: #3B82D6; --accent-soft: #DCEBFB; }
body.user-sophie { --accent: #E0559A; --accent-soft: #FBDFEE; }

@keyframes bgShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: linear-gradient(135deg,
    #FFF6E9 0%, #FFE0F0 20%, #E0F4FF 40%, #FFF6E9 60%, #E8FFE0 80%, #FFF0D6 100%);
  background-size: 400% 400%;
  animation: bgShift 20s ease infinite;
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}
body.user-toby {
  background: linear-gradient(135deg,
    #E0F0FF 0%, #D0E8FF 20%, #E8F8FF 40%, #C8E4FF 60%, #D6ECFF 80%, #E0F0FF 100%);
  background-size: 400% 400%;
  animation: bgShift 20s ease infinite;
}
body.user-sophie {
  background: linear-gradient(135deg,
    #FFE0F0 0%, #FFD0E8 20%, #FFE8F4 40%, #FFC8E0 60%, #FFD6EC 80%, #FFE0F0 100%);
  background-size: 400% 400%;
  animation: bgShift 20s ease infinite;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.hidden { display: none !important; }

.screen { max-width: 860px; margin: 0 auto; padding: 20px 20px 60px; }

/* ─────────── 登录页 ─────────── */
#screen-login { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.login-wrap { text-align: center; }
.login-panda { font-size: 84px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.login-title { font-size: 46px; margin: 8px 0 4px; letter-spacing: 6px; }
.login-sub { color: var(--ink-2); font-size: 18px; margin-bottom: 34px; }
.login-cards { display: flex; gap: 26px; justify-content: center; flex-wrap: wrap; }
.login-card {
  width: 210px; padding: 30px 20px 24px; border-radius: 28px; background: var(--card);
  box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: transform .15s, box-shadow .15s; border: 4px solid transparent;
}
.login-card:hover { transform: translateY(-6px) scale(1.03); box-shadow: 0 10px 24px rgba(120,90,40,.2); }
.login-card.toby:hover   { border-color: #3B82D6; }
.login-card.sophie:hover { border-color: #E0559A; }
.login-avatar { font-size: 74px; }
.login-name { font-size: 30px; font-weight: 700; }
.login-card.toby .login-name   { color: #3B82D6; }
.login-card.sophie .login-name { color: #E0559A; }
.login-hint { font-size: 14px; color: var(--ink-2); min-height: 18px; }

/* ─────────── 顶栏 ─────────── */
#topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 16px;
  background: rgba(255, 255, 255, .75); backdrop-filter: blur(10px);
  padding: 10px 20px; border-bottom: 2px solid rgba(255,255,255,.5);
}
.top-home { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px; }
.top-home:hover { background: var(--accent-soft); }
#top-avatar { font-size: 26px; }
.top-progress { flex: 1; display: flex; align-items: center; gap: 10px; }
.top-bar { flex: 1; max-width: 340px; height: 14px; background: #F0E5D3; border-radius: 999px; overflow: hidden; }
#top-bar-fill { height: 100%; width: 0; background: var(--green); border-radius: 999px; transition: width .6s; }
#top-count { font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.top-switch { padding: 7px 16px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-size: 14px; }
.top-switch:hover { background: var(--accent-soft); }

/* ─────────── 主页 ─────────── */
.home-hero { display: flex; align-items: center; gap: 36px; background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 34px; margin: 26px 0; flex-wrap: wrap; }
.ring-wrap { position: relative; width: 170px; height: 170px; flex-shrink: 0; }
#ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #F0E5D3; stroke-width: 12; }
.ring-fg { fill: none; stroke: var(--green); stroke-width: 12; stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 1s ease; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#ring-num { font-size: 42px; font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; }
.ring-label { font-size: 14px; color: var(--ink-2); }
.home-greet { flex: 1; min-width: 260px; }
#greet { font-size: 32px; margin-bottom: 4px; }
#greet-sub { color: var(--ink-2); margin-bottom: 18px; }
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-tile { background: var(--bg); border-radius: 14px; padding: 10px 18px; text-align: center; min-width: 86px; }
.stat-num { display: block; font-size: 26px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; color: var(--ink-2); }

.home-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; }
.action-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px 18px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform .15s, box-shadow .15s; border: 3px solid transparent; }
.action-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: 0 10px 24px rgba(120,90,40,.18); }
.action-emoji { font-size: 48px; }
.action-title { font-size: 24px; font-weight: 800; }
.action-sub { font-size: 13px; color: var(--ink-2); }

/* ─────────── 通用头部 ─────────── */
.screen-head { display: flex; align-items: center; gap: 16px; margin: 18px 0 22px; flex-wrap: wrap; }
.screen-head h2 { font-size: 26px; }
.screen-head-note { color: var(--ink-2); font-size: 14px; }
.btn-back { padding: 8px 16px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-size: 15px; font-weight: 600; }
.btn-back:hover { background: var(--accent-soft); }
.btn-tool { padding: 8px 16px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-size: 15px; font-weight: 600; }
.btn-tool:hover { background: var(--accent-soft); }
.btn-big { padding: 14px 34px; border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 19px; font-weight: 800; box-shadow: var(--shadow); transition: transform .12s; }
.btn-big:hover { transform: scale(1.04); }
.btn-big:disabled { background: #D8CCBC; transform: none; cursor: default; }
.btn-secondary { background: var(--card); color: var(--ink); }

/* ─────────── 课文目录 ─────────── */
.article-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.article-card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 16px 18px;
  display: flex; align-items: center; gap: 14px; text-align: left; transition: transform .12s; border: 3px solid transparent; }
.article-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.article-card.done { background: var(--green-soft); }
.article-day { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-soft); color: var(--accent);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
.article-day small { font-size: 10px; font-weight: 600; }
.article-day b { font-size: 20px; }
.article-card.done .article-day { background: var(--green); color: #fff; }
.article-meta { flex: 1; min-width: 0; }
.article-title { display: block; font-size: 18px; font-weight: 700; font-family: var(--hanzi-font);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.article-sub { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.article-check { font-size: 20px; }

/* ─────────── 课文阅读 ─────────── */
.reader-tools { margin-left: auto; display: flex; gap: 10px; }
.reader-body { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 34px 38px; font-family: var(--hanzi-font); }
.reader-body h1 { text-align: center; font-size: 34px; margin-bottom: 26px; letter-spacing: 4px; }
.reader-body p { font-size: 30px; line-height: 2.3; text-indent: 2em; margin-bottom: 14px; letter-spacing: 2px; }
body.pinyin-off rt { visibility: hidden; }
rt { font-size: 12px; color: var(--ink-2); font-family: "PingFang SC", sans-serif; letter-spacing: 0; }
.ch { cursor: pointer; border-radius: 8px; padding: 0 1px; transition: background .12s; }
.ch:hover { background: var(--accent-soft); }
.ch.marked { background: var(--amber-soft); box-shadow: inset 0 -3px 0 var(--amber); }
.reader-newchars { margin-top: 22px; }
.reader-newchars h3 { font-size: 18px; margin-bottom: 12px; }
.newchars-hint { font-size: 13px; color: var(--ink-2); font-weight: 400; }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 8px 12px 6px;
  display: flex; flex-direction: column; align-items: center; min-width: 58px; transition: transform .12s; border: 2px solid transparent; }
.chip:hover { transform: translateY(-3px); border-color: var(--accent); }
.chip .chip-py { font-size: 12px; color: var(--ink-2); }
.chip .chip-ch { font-size: 26px; font-family: var(--hanzi-font); }
.chip.lv1 { background: var(--amber-soft); }
.chip.lv2 { background: var(--green-soft); }
.chip.marked { border-color: var(--amber); }
.reader-footer { margin-top: 26px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.reader-nav { margin-left: auto; display: flex; gap: 10px; }
.btn-big.done-already { background: var(--green); }

/* ─────────── 写汉字 ─────────── */
.write-section { margin-bottom: 30px; }
.write-section h3 { font-size: 19px; margin-bottom: 12px; }
.write-empty { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 30px; text-align: center; color: var(--ink-2); font-size: 16px; line-height: 1.9; }
.lesson-picker { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.lesson-picker select { font-size: 16px; padding: 8px 12px; border-radius: 12px; border: 2px solid #E8DCC8;
  background: var(--card); color: var(--ink); font-family: inherit; }

/* ─────────── 写字弹窗 ─────────── */
.modal { position: fixed; inset: 0; background: rgba(61, 50, 41, .45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: var(--card); border-radius: 26px; padding: 26px 30px 24px; position: relative;
  box-shadow: 0 18px 50px rgba(0,0,0,.25); text-align: center; max-width: 92vw; }
.modal-close { position: absolute; top: 12px; right: 14px; font-size: 20px; color: var(--ink-2);
  width: 38px; height: 38px; border-radius: 999px; }
.modal-close:hover { background: var(--bg); }
.modal-charinfo { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 10px; }
.modal-pinyin { font-size: 26px; color: var(--accent); font-weight: 700; }
.writer-target { width: 280px; height: 280px; margin: 0 auto; border-radius: 18px;
  background:
    linear-gradient(to right, transparent calc(50% - 1px), #F0E5D3 calc(50% - 1px), #F0E5D3 calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(to bottom, transparent calc(50% - 1px), #F0E5D3 calc(50% - 1px), #F0E5D3 calc(50% + 1px), transparent calc(50% + 1px)),
    #FFFDF8;
  border: 3px solid #E8DCC8; }
.modal-actions { display: flex; gap: 12px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.btn-exam { background: var(--green); }
.modal-quiz { margin-top: 16px; }
.modal-quiz #modal-quiz-input { font-size: 22px; padding: 8px 14px; width: 170px; text-align: center;
  border: 3px solid #E8DCC8; border-radius: 14px; background: #FFFDF8; color: var(--ink);
  font-family: inherit; outline: none; }
.modal-quiz #modal-quiz-input:focus { border-color: var(--accent); }
.modal-quiz .tone-row { margin-top: 12px; }
.modal-quiz .tone-btn { width: 52px; height: 48px; font-size: 19px; border-radius: 13px; }
.modal-quiz .test-feedback { margin-top: 12px; min-height: 30px; font-size: 17px; }
.modal-note { min-height: 26px; margin-top: 12px; font-size: 17px; font-weight: 700; color: var(--green); }
.modal-notebook { margin-top: 4px; font-size: 13.5px; }

/* ─────────── 测一测 ─────────── */
.test-body { max-width: 560px; margin: 0 auto; }
.test-intro { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 40px 34px; text-align: center; }
.test-intro .test-emoji { font-size: 64px; }
.test-intro h3 { font-size: 26px; margin: 12px 0 8px; }
.test-intro p { color: var(--ink-2); line-height: 1.9; margin-bottom: 22px; }
.test-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 30px 34px 34px; text-align: center; }
.test-dots { display: flex; gap: 7px; justify-content: center; margin-bottom: 18px; }
.test-dot { width: 12px; height: 12px; border-radius: 999px; background: #EDE4D4; }
.test-dot.ok { background: var(--green); }
.test-dot.bad { background: var(--red); }
.test-dot.now { background: var(--accent); transform: scale(1.25); }
.test-char { font-size: 130px; font-family: var(--hanzi-font); line-height: 1.25; }
.test-q { color: var(--ink-2); margin: 2px 0 18px; }
.test-input-row { display: flex; gap: 10px; justify-content: center; align-items: center; }
#test-input { font-size: 26px; padding: 10px 16px; width: 200px; text-align: center;
  border: 3px solid #E8DCC8; border-radius: 16px; background: #FFFDF8; color: var(--ink);
  font-family: inherit; outline: none; }
#test-input:focus { border-color: var(--accent); }
.test-hint { font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.tone-row { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.tone-btn { width: 62px; height: 56px; border-radius: 16px; background: var(--bg); font-size: 22px;
  font-weight: 700; box-shadow: var(--shadow); transition: transform .1s; border: 2px solid transparent; }
.tone-btn:hover { transform: scale(1.08); border-color: var(--accent); }
.tone-btn small { display: block; font-size: 10px; color: var(--ink-2); font-weight: 500; }
.test-feedback { margin-top: 20px; min-height: 60px; font-size: 20px; font-weight: 700; }
.test-feedback .fb-good { color: var(--green); }
.test-feedback .fb-bad { color: var(--red); }
.fb-answer { font-size: 30px; color: var(--accent); font-weight: 800; }
.test-next { margin-top: 10px; }
.test-result { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 40px 34px; text-align: center; }
.test-result .result-emoji { font-size: 72px; }
.test-result h3 { font-size: 30px; margin: 10px 0; }
.test-result p { color: var(--ink-2); margin-bottom: 8px; line-height: 1.8; }
.result-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 16px 0 24px; }

/* ─────────── 打卡墙 ─────────── */
.wall-legend { margin-left: auto; display: flex; gap: 14px; font-size: 13.5px; flex-wrap: wrap; }
.lg { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.lg::before { content: ""; width: 14px; height: 14px; border-radius: 4px; }
.lg-mastered::before { background: var(--green); }
.lg-learning::before { background: var(--amber); }
.lg-todo::before { background: var(--gray-cell); border: 1px solid #DDD2C0; }
.wall-lesson { margin-bottom: 18px; }
.wall-lesson-head { font-size: 14px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; }
.wall-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.wall-cell { width: 34px; height: 34px; border-radius: 8px; background: var(--gray-cell);
  font-size: 19px; font-family: var(--hanzi-font); color: #B0A28F;
  display: flex; align-items: center; justify-content: center; transition: transform .1s; }
.wall-cell:hover { transform: scale(1.25); z-index: 2; box-shadow: var(--shadow); }
.wall-cell.lv1 { background: var(--amber); color: #4A3608; font-weight: 700; }
.wall-cell.lv2 { background: var(--green); color: #fff; font-weight: 700; }

/* ─────────── 庆祝 ─────────── */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; overflow: hidden; }
.confetti span { position: absolute; top: -40px; font-size: 30px; animation: fall linear forwards; }
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: .6; }
}

/* ─────────── 拼音打字 ─────────── */
@keyframes charBounce { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes charShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes lineSlideIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scorePop { 0% { transform: scale(1); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes sparkle { 0% { opacity: 1; transform: scale(0) rotate(0deg); } 50% { opacity: 1; transform: scale(1.2) rotate(180deg); } 100% { opacity: 0; transform: scale(0.5) rotate(360deg) translateY(-30px); } }
@keyframes pulseGlow { 0%,100% { box-shadow: 0 0 0 0 rgba(21,128,61,.3); } 50% { box-shadow: 0 0 12px 4px rgba(21,128,61,.15); } }
@keyframes inputWiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-1deg); } 75% { transform: rotate(1deg); } }

.typing-body { background: var(--card); border-radius: 28px; box-shadow: var(--shadow);
  padding: 34px 38px; font-family: var(--hanzi-font); position: relative; overflow: hidden; }
.typing-body::before { content: "✏️"; position: absolute; top: 12px; right: 18px; font-size: 28px;
  opacity: .15; animation: bob 3s ease-in-out infinite; }
.typing-title { text-align: center; margin-bottom: 24px; }
.typing-line { margin-bottom: 24px; animation: lineSlideIn .5s ease both;
  background: linear-gradient(135deg, rgba(255,138,61,.04), rgba(255,138,61,.01));
  border-radius: 18px; padding: 18px 20px 14px; border: 2px solid rgba(255,138,61,.08); }
.typing-line:nth-child(2) { animation-delay: .1s; }
.typing-line:nth-child(3) { animation-delay: .2s; }
.typing-line:nth-child(4) { animation-delay: .3s; }
.typing-line:nth-child(5) { animation-delay: .4s; }
.typing-line:nth-child(6) { animation-delay: .5s; }
.typing-charrow { font-size: 32px; line-height: 1.7; letter-spacing: 4px; margin-bottom: 10px; }
.typing-char { transition: all .2s cubic-bezier(.34,1.56,.64,1); border-radius: 8px; padding: 2px 3px;
  display: inline-block; }
.typing-char.ok { color: var(--green); background: var(--green-soft); animation: charBounce .4s ease;
  text-shadow: 0 0 8px rgba(21,128,61,.2); }
.typing-char.bad { color: var(--red); background: #FEE; animation: charShake .3s ease; }
.typing-punct { color: var(--ink-2); }
.typing-line-input { width: 100%; font-size: 22px; padding: 14px 18px; border: 3px solid #E8DCC8;
  border-radius: 18px; background: #FFFDF8; color: var(--ink); font-family: inherit;
  outline: none; transition: border-color .2s, box-shadow .2s; }
.typing-line-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.typing-line-input.line-complete { border-color: var(--green); background: var(--green-soft);
  animation: pulseGlow 1.5s ease infinite; }
.typing-score { font-size: 20px; font-weight: 800; color: var(--accent);
  display: inline-flex; align-items: center; gap: 4px; }
.typing-score.pop { animation: scorePop .3s ease; }
.typing-tools { margin-left: auto; }
.typing-sparkle { position: absolute; pointer-events: none; font-size: 18px;
  animation: sparkle .6s ease forwards; z-index: 10; }

/* ─────────── 购物 & 祝酒词汇 ─────────── */
@keyframes cardPopIn { from { opacity: 0; transform: scale(.8) translateY(16px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes cardHoverBounce { 0% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-10px) rotate(-2deg); } 60% { transform: translateY(-6px) rotate(1deg); } 100% { transform: translateY(-8px) rotate(0); } }
@keyframes levelSlideIn { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes emojiFloat { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-6px) rotate(5deg); } }
@keyframes clickRipple { 0% { transform: scale(0); opacity: .5; } 100% { transform: scale(2.5); opacity: 0; } }
@keyframes speakPulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }

/* Floating background decorations */
@keyframes floatUp {
  0% { transform: translateY(0) rotate(0deg) scale(1); opacity: .7; }
  50% { transform: translateY(-40vh) rotate(180deg) scale(1.1); opacity: .5; }
  100% { transform: translateY(-80vh) rotate(360deg) scale(.9); opacity: 0; }
}
@keyframes floatSway {
  0%,100% { transform: translateX(0) rotate(-5deg); }
  50% { transform: translateX(30px) rotate(5deg); }
}
@keyframes rainbowShift {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}
.vocab-float {
  position: fixed; pointer-events: none; z-index: 0; font-size: 40px;
  animation: floatUp linear forwards;
}
.vocab-float:nth-child(odd) { animation-name: floatUp; }
.vocab-float.sway { animation: floatSway 3s ease-in-out infinite; }

.vocab-body { max-width: 860px; position: relative; z-index: 1; }
.vocab-level { margin-bottom: 32px; animation: levelSlideIn .5s ease both; }
.vocab-level:nth-child(2) { animation-delay: .1s; }
.vocab-level:nth-child(3) { animation-delay: .2s; }
.vocab-level:nth-child(4) { animation-delay: .3s; }
.vocab-level:nth-child(5) { animation-delay: .4s; }
.vocab-level h3 { font-size: 20px; margin-bottom: 16px; color: var(--accent); font-weight: 800;
  display: flex; align-items: center; gap: 8px; }
.vocab-level h3::before { content: "⭐"; animation: emojiFloat 2s ease-in-out infinite; font-size: 22px; }
.vocab-level:nth-child(2) h3::before { content: "🌟"; animation-delay: .3s; }
.vocab-level:nth-child(3) h3::before { content: "✨"; animation-delay: .6s; }
.vocab-level:nth-child(4) h3::before { content: "🎯"; animation-delay: .9s; }
.vocab-level:nth-child(5) h3::before { content: "🏆"; animation-delay: 1.2s; }
.vocab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.vocab-card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow);
  padding: 18px 20px; cursor: pointer; transition: all .25s cubic-bezier(.34,1.56,.64,1);
  border: 3px solid transparent; position: relative; overflow: hidden;
  animation: cardPopIn .4s ease both; }
.vocab-card:nth-child(1) { animation-delay: .05s; } .vocab-card:nth-child(2) { animation-delay: .1s; }
.vocab-card:nth-child(3) { animation-delay: .15s; } .vocab-card:nth-child(4) { animation-delay: .2s; }
.vocab-card:nth-child(5) { animation-delay: .25s; } .vocab-card:nth-child(6) { animation-delay: .3s; }
.vocab-card:nth-child(7) { animation-delay: .35s; } .vocab-card:nth-child(8) { animation-delay: .4s; }
.vocab-card:nth-child(9) { animation-delay: .45s; } .vocab-card:nth-child(10) { animation-delay: .5s; }
.vocab-card:hover { transform: translateY(-8px) scale(1.03); border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(120,90,40,.18); }
.vocab-card:active { transform: translateY(-2px) scale(.98); }
.vocab-card::after { content: "🔊"; position: absolute; top: 8px; right: 10px; font-size: 14px;
  opacity: 0; transition: opacity .2s; }
.vocab-card:hover::after { opacity: .5; }
.vocab-card.speaking { animation: speakPulse .4s ease; }
.vocab-text { font-size: 28px; font-weight: 800; font-family: var(--hanzi-font); margin-bottom: 6px;
  transition: transform .2s; }
.vocab-card:hover .vocab-text { transform: scale(1.08); }
.vocab-py { font-size: 15px; color: var(--accent); font-weight: 700; margin-bottom: 6px; }
.vocab-ctx { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.vocab-ripple { position: absolute; border-radius: 50%; background: var(--accent-soft);
  width: 40px; height: 40px; pointer-events: none; animation: clickRipple .5s ease forwards; }

/* ─────────── 形声字 ─────────── */
.xs-hint { font-size: 14px; color: var(--ink-2); margin-bottom: 14px; font-style: italic; }
.xs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.xs-card { background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  padding: 16px; text-align: center; cursor: pointer; position: relative; overflow: hidden;
  transition: all .25s cubic-bezier(.34,1.56,.64,1); border: 3px solid transparent;
  animation: cardPopIn .4s ease both; }
.xs-card:hover { transform: translateY(-6px) scale(1.04); border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(120,90,40,.15); }
.xs-card:active { transform: translateY(-1px) scale(.97); }
.xs-card::after { content: "🔊"; position: absolute; top: 6px; right: 8px; font-size: 12px;
  opacity: 0; transition: opacity .2s; }
.xs-card:hover::after { opacity: .5; }
.xs-char { font-size: 36px; font-weight: 800; font-family: var(--hanzi-font); line-height: 1.2; }
.xs-radical { font-size: 13px; color: var(--red); font-weight: 700; margin-top: 4px;
  background: rgba(226,85,75,.08); border-radius: 8px; padding: 2px 8px; display: inline-block; }
.xs-py { font-size: 14px; color: var(--accent); font-weight: 700; margin-top: 6px; }
.xs-meaning { font-size: 12px; color: var(--ink-2); margin-top: 4px; line-height: 1.4; }

/* ─────────── 相似字 ─────────── */
.similar-section { max-width: 700px; }
.similar-card { background: var(--card); border-radius: 22px; box-shadow: var(--shadow);
  padding: 20px 24px; margin-bottom: 16px; display: flex; align-items: center;
  justify-content: center; gap: 16px; position: relative; flex-wrap: wrap;
  animation: cardPopIn .4s ease both; }
.similar-card:nth-child(even) { animation-delay: .1s; }
.similar-side { flex: 1; text-align: center; cursor: pointer; padding: 10px;
  border-radius: 16px; transition: background .2s; min-width: 100px; }
.similar-side:hover { background: var(--accent-soft); }
.similar-char { font-size: 48px; font-weight: 800; font-family: var(--hanzi-font); line-height: 1.2; }
.similar-py { font-size: 15px; color: var(--accent); font-weight: 700; margin-top: 4px; }
.similar-meaning { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.similar-vs { font-size: 18px; font-weight: 800; color: var(--red); padding: 6px 12px;
  background: rgba(226,85,75,.08); border-radius: 999px; flex-shrink: 0; }
.similar-hint { width: 100%; text-align: center; font-size: 14px; color: var(--ink-2);
  background: var(--amber-soft); border-radius: 12px; padding: 10px 14px; margin-top: 8px;
  border-left: 4px solid var(--amber); }
.similar-reveal { margin-top: 8px; font-size: 13px; padding: 6px 14px;
  border-radius: 999px; border: 2px solid var(--accent); background: transparent;
  color: var(--accent); cursor: pointer; font-weight: 700; transition: all .2s; }
.similar-reveal:hover { background: var(--accent); color: #fff; }

/* ─────────── 手机适配 ─────────── */
@media (max-width: 600px) {
  .reader-body { padding: 22px 18px; }
  .reader-body p { font-size: 24px; }
  .home-hero { padding: 22px; gap: 20px; justify-content: center; }
  .test-char { font-size: 96px; }
  .wall-cell { width: 30px; height: 30px; font-size: 17px; }
  .typing-body { padding: 18px 14px; }
  .typing-charrow { font-size: 24px; }
  .typing-line-input { font-size: 16px; padding: 10px 12px; }
  .vocab-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .xs-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .xs-char { font-size: 28px; }
  .similar-char { font-size: 36px; }
  .similar-card { gap: 10px; padding: 14px 16px; }
}
