/* ============ 汉字认字 #/hanzi ============ */
.hanzi {
  --h-bg: #FBF6EF;
  --h-grid: #E6D9CB;
  --h-sun: #F2B544;
  --h-good: #4F9A5E;
  --h-bad: #D2604B;
  min-height: 100vh; min-height: 100dvh; background: var(--h-bg);
  display: flex; flex-direction: column; user-select: none; -webkit-user-select: none;
}
.hanzi button { border: 0; background: none; padding: 0; }
.hanzi .grow { flex: 1; }

/* ---------- 顶栏 ---------- */
.h-head { display: flex; align-items: center; gap: 16px; padding: 14px 24px 6px; }
.h-back { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 22px; }
.h-back:hover { border-color: var(--clay); }
.h-title { font-weight: 700; font-size: 22px; line-height: 1.05; }
.h-title small { display: block; font-size: 12px; font-weight: 500; color: var(--ink-3); letter-spacing: .08em; }
.h-modes { margin-left: auto; display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.h-modes button { padding: 9px 20px; border-radius: 999px; font-weight: 600; font-size: 16px; color: var(--ink-2); }
.h-modes button.on { background: var(--clay); color: #fff; }
.h-stars { font-size: 20px; font-weight: 700; background: #FFF4D6; border-radius: 999px; padding: 7px 16px; color: #7A5A12; font-variant-numeric: tabular-nums; }
.h-streak { font-size: 20px; font-weight: 700; background: #F6E3DA; border-radius: 999px; padding: 7px 16px; color: var(--clay-deep); text-decoration: none; font-variant-numeric: tabular-nums; }
.h-streak:hover { background: #F0D5C8; }

/* ---------- 字表 / 开关 ---------- */
.h-books { display: flex; gap: 8px; padding: 8px 24px; overflow-x: auto; align-items: center; scrollbar-width: none; }
.h-books::-webkit-scrollbar { display: none; }
.h-books button { white-space: nowrap; padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); }
.h-books button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.h-books .h-tog { color: var(--ink-3); }
.h-books .h-tog::before { content: "○ "; }
.h-books .h-tog.on { background: #EAF3EC; color: var(--h-good); border-color: #CFE3D4; }
.h-books .h-tog.on::before { content: "● "; }

.h-stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; padding: 12px 96px 48px; min-height: 0; }
.h-empty { text-align: center; font-size: 20px; line-height: 1.7; color: var(--ink-2); padding: 60px 20px; margin: auto; }
.h-empty a { color: var(--clay-deep); }
.h-audio-status { margin: 4px 24px 8px; padding: 10px 14px; border: 1px solid #D7B6A6; border-radius: 12px; background: #FFF9F2; color: var(--clay-deep); font-size: 15px; line-height: 1.6; text-align: center; }
.h-audio-status[hidden] { display: none; }
.hanzi .h-audio-status button { padding: 3px 10px; border: 1px solid currentColor; border-radius: 8px; color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.h-audio-status button:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* ---------- 认读 ---------- */
.h-card { display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 1.6vh, 20px); animation: hIn .35s ease; }
@keyframes hIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.h-pinyin { font-size: clamp(26px, 4vh, 46px); font-weight: 500; color: var(--clay-deep); letter-spacing: .06em; min-height: 1.2em; }
.hanzi.h-nopinyin .h-pinyin { display: none; }

/* 田字格：浅色虚线十字，不抢字 */
.h-read { display: flex; align-items: center; gap: clamp(16px, 3vw, 40px); }
.h-pic { width: clamp(140px, 26vh, 260px); aspect-ratio: 1; border-radius: 26px; overflow: hidden; background: #fff; box-shadow: 0 10px 30px rgba(80,50,30,.10), 0 0 0 1px rgba(80,50,30,.04); }
.h-pic img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.h-tian {
  position: relative; width: clamp(180px, 34vh, 340px); aspect-ratio: 1;
  border: 1px solid var(--h-grid); border-radius: 20px; background: #fff;
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 10px 30px rgba(80,50,30,.10), 0 0 0 1px rgba(80,50,30,.04);
  transition: transform .15s;
}
.h-tian:active { transform: scale(.98); }
.h-tian::before, .h-tian::after { content: ""; position: absolute; pointer-events: none; opacity: .85; }
.h-tian::before { left: 0; right: 0; top: 50%; border-top: 1px dashed var(--h-grid); }
.h-tian::after { top: 0; bottom: 0; left: 50%; border-left: 1px dashed var(--h-grid); }
.h-tian span { font-size: clamp(120px, 24vh, 240px); font-weight: 700; line-height: 1; color: var(--ink); }
.h-tian:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }

.h-tags { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 34px; }
.h-tag { font-size: clamp(18px, 2.2vw, 24px); font-weight: 600; color: var(--clay-deep); background: #FFF1E9; border: 1px solid #EFD8CB; border-radius: 999px; padding: 4px 16px; }
.h-sent { font-size: clamp(18px, 2.2vw, 26px); color: var(--ink-2); line-height: 1.4; cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.h-sent i { font-style: normal; font-size: .8em; }
.h-sent:hover { color: var(--ink); }
.h-ctrl { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 6px; }

.hanzi .h-big { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-width: 0; min-height: 60px; padding: 16px 24px; border: 1px solid transparent; border-radius: 20px; background: var(--clay-deep); color: #fff; font-size: 20px; font-weight: 700; line-height: 1.2; white-space: nowrap; cursor: pointer; box-shadow: 0 4px 0 rgba(112, 57, 40, .18); transition: background-color .15s, border-color .15s, box-shadow .15s, transform .15s; }
.hanzi .h-big.ghost { background: #FFF9F2; color: var(--clay-deep); border-color: #D7B6A6; box-shadow: 0 4px 0 rgba(112, 57, 40, .07); }
.h-big svg { width: 24px; height: 24px; flex: none; }
@media (hover: hover) {
  .hanzi .h-big:hover { background: #95513E; box-shadow: 0 5px 0 rgba(112, 57, 40, .2); transform: translateY(-1px); }
  .hanzi .h-big.ghost:hover { background: #F6E6DF; border-color: var(--clay-deep); box-shadow: 0 5px 0 rgba(112, 57, 40, .09); }
}
.hanzi .h-big:active { background: #854635; box-shadow: 0 1px 0 rgba(112, 57, 40, .18); transform: translateY(3px); }
.hanzi .h-big.ghost:active { background: #EFDBCF; border-color: var(--clay-deep); box-shadow: 0 1px 0 rgba(112, 57, 40, .09); }
.hanzi .h-big:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }

.h-arrow { position: absolute; top: 50%; transform: translateY(-60%); width: 68px; height: 68px; border-radius: 50%; background: var(--card) !important; box-shadow: 0 4px 16px rgba(80,50,30,.12); font-size: 44px; line-height: 1; color: var(--ink); cursor: pointer; display: grid; place-items: center; padding-bottom: 6px !important; }
.h-arrow.prev { left: 18px; }
.h-arrow.next { right: 18px; }
.h-arrow:disabled { opacity: .25; cursor: default; }
.h-arrow:not(:disabled):hover { background: #fff !important; color: var(--clay-deep); }
.h-dots { position: absolute; bottom: 16px; left: 0; right: 0; display: flex; gap: 6px; justify-content: center; font-size: 14px; color: var(--ink-3); font-weight: 600; }
.h-dots i { width: 8px; height: 8px; border-radius: 50%; background: #E2D4C8; transition: all .2s; }
.h-dots i.on { width: 22px; border-radius: 4px; background: var(--clay); }

/* ---------- 选字 ---------- */
.h-quiz { display: flex; flex-direction: column; align-items: center; gap: 22px; width: 100%; }
.h-ask { display: flex; align-items: center; gap: 14px; font-size: 34px; background: var(--card) !important; border-radius: 999px; padding: 12px 28px 12px 20px !important; box-shadow: 0 6px 20px rgba(80,50,30,.10); cursor: pointer; transition: transform .12s; }
.h-ask svg { width: 34px; height: 34px; color: var(--clay-deep); }
.h-ask span { font-size: 20px; font-weight: 600; color: var(--ink-2); }
.h-ask:active { transform: scale(.96); }
.h-ask-pinyin { flex-direction: column; gap: 2px; padding: 14px 40px !important; cursor: default; }
.h-py { font-size: clamp(40px, 7vh, 72px); font-weight: 700; color: var(--clay-deep); letter-spacing: .04em; line-height: 1.1; }
.h-opts { display: grid; gap: clamp(14px, 2.4vw, 28px); width: 100%; justify-content: center; }
.h-opts.n2 { grid-template-columns: repeat(2, min(40vh, 26vw)); }
.h-opts.n3 { grid-template-columns: repeat(3, min(40vh, 22vw)); }
.h-opts.n4 { grid-template-columns: repeat(4, min(38vh, 17vw)); }
.h-opt { cursor: pointer; aspect-ratio: 1; display: grid; place-items: center; background: #fff; border: 2px solid var(--line); border-radius: 28px; font-size: clamp(64px, 12vh, 130px); font-weight: 700; line-height: 1; color: var(--ink); box-shadow: 0 8px 24px rgba(80,50,30,.08); transition: transform .15s, opacity .3s, border-color .2s; }
.h-opt:hover:not(:disabled) { transform: translateY(-4px); border-color: var(--clay); }
.h-opt.right { border-color: var(--h-good); color: var(--h-good); animation: hBounce .5s ease; }
.h-opt.wrong { opacity: .35; border-color: var(--h-bad); animation: hShake .4s ease; }
.h-opt.fade { opacity: .25; }
@keyframes hShake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes hBounce { 40% { transform: scale(1.05); } }
.h-feedback { min-height: 40px; font-size: 26px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; text-align: center; }
.h-feedback b { color: var(--h-good); font-size: 30px; }
.h-pop { display: inline-block; animation: hPop .5s cubic-bezier(.3,1.6,.5,1); font-size: 32px; }
@keyframes hPop { from { transform: scale(.2); opacity: 0; } }

/* ---------- 打卡 ---------- */
.h-party { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; pointer-events: none; animation: hFade 3.2s ease forwards; }
.h-party-card { background: #fff; border-radius: 32px; padding: 30px 48px; text-align: center; box-shadow: 0 20px 60px rgba(80,50,30,.25); display: flex; flex-direction: column; gap: 6px; animation: hPop .6s cubic-bezier(.3,1.6,.5,1); }
.h-party-icon { font-size: 64px; line-height: 1; }
.h-party b { font-size: 30px; color: var(--h-good); }
.h-party span:last-child { font-size: 18px; color: var(--ink-2); }
@keyframes hFade { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- 竖屏 / 手机 ---------- */
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  .h-head { padding: 12px 16px 4px; gap: 10px; flex-wrap: wrap; }
  .h-title { font-size: 18px; }
  .h-modes button { padding: 7px 12px; font-size: 14px; }
  .h-stars, .h-streak { font-size: 16px; padding: 5px 12px; }
  .h-books { padding: 6px 16px; }
  .h-stage { padding: 8px 16px 44px; align-items: flex-start; }
  .h-card { gap: 10px; width: 100%; }
  .h-read { flex-direction: column; gap: 12px; }
  .h-pic { width: min(52vw, 28vh); }
  .h-tian { width: min(64vw, 40vh); }
  .h-tian span { font-size: min(44vw, 26vh); }
  .h-pinyin { font-size: clamp(22px, 3.4vh, 34px); }
  .h-arrow { display: none; }
  .h-dots { bottom: 12px; }
  .hanzi .h-big { min-height: 56px; padding: 14px 16px; border-radius: 18px; font-size: 17px; }
  .h-quiz { gap: 16px; }
  .h-ask { font-size: 26px; }
  .h-ask span { font-size: 16px; }
  .h-ask svg { width: 28px; height: 28px; }
  .h-opts { max-width: 520px; gap: 12px; }
  .h-opts.n2, .h-opts.n3, .h-opts.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .h-opt { font-size: clamp(56px, 17vw, 110px); border-radius: 22px; }
  .h-feedback { font-size: 22px; }
  .h-feedback b { font-size: 26px; }
}
@media (max-width: 760px) {
  .h-modes { order: 3; margin-left: 0; }
  .h-streak { margin-left: auto; }
  .h-party-card { padding: 22px 32px; }
  .h-party b { font-size: 24px; }
}
