/* ============================================================
   打字练习 v4 —— 照搬 https://heboinfo.com/syjx 「专项学习 · 打字」子系统
   组件：PracticeKeyboard / KeyboardHands / Practice 页面
   ============================================================ */

.ty4-drill{background:linear-gradient(135deg,#fefce8 0%,#f0f9ff 50%,#f5f3ff 100%);
  border:1px solid var(--line);border-radius:14px;padding:16px 16px 14px;box-shadow:var(--shadow)}

/* ---------- 页头 / 面包屑 ---------- */
.ty4-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-bottom:10px}
.ty4-crumb{display:flex;align-items:center;gap:6px;font-size:13.5px;color:#4b5563;min-width:0}
.ty4-crumb .sep{color:#9ca3af}
.ty4-crumb .cur{color:#1f2937;font-weight:600}
.ty4-tag{flex:0 0 auto;font-size:12px;font-weight:600;color:#92400e;background:#fef3c7;
  border:1px solid #fcd34d;border-radius:999px;padding:2px 10px}
.ty4-sub{font-size:12.5px;color:var(--sub);margin:-4px 0 10px}

/* ---------- 字母条 ---------- */
.ty4-letters{position:relative;display:block;height:64px;overflow-x:auto;overflow-y:hidden;
  padding:11px 16px 5px;background:rgba(255,255,255,.85);border:1px solid #e5e7eb;
  border-radius:14px;margin-bottom:8px;white-space:nowrap;line-height:1;scroll-behavior:smooth}
.ty4-line{display:inline-flex;flex-wrap:nowrap;align-items:center;gap:4px;
  vertical-align:middle;padding:0 50%}
@keyframes ty4row{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
.ty4-pill{display:inline-flex;justify-content:center;align-items:center;width:34px;height:34px;
  border:2px solid transparent;border-radius:8px;background:#f3f4f6;color:#6b7280;
  font-family:"Courier New","Consolas",monospace;font-size:16px;font-weight:700;transition:all .2s}
.ty4-pill.done{background:#dbeafe;border-color:#93c5fd;color:#1e40af;opacity:.75}
.ty4-pill.cur{background:#dbeafe;border-color:#3b82f6;color:#1e40af;transform:scale(1.15);
  box-shadow:0 0 12px rgba(59,130,246,.35)}

/* ---------- 四项统计 ---------- */
.ty4-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin-bottom:8px}
.ty4-stats .s{background:rgba(255,255,255,.85);border:1px solid #e5e7eb;border-radius:10px;
  padding:8px 10px;text-align:center}
.ty4-stats .s b{display:block;font-size:20px;font-weight:700;color:#1f2937;line-height:1.3;
  font-family:"Consolas","Menlo",monospace}
.ty4-stats .s b.g{color:#34d399}
.ty4-stats .s i{font-style:normal;font-size:11px;color:#9ca3af}

/* ---------- 进度条 ---------- */
.ty4-pbar{height:10px;background:#e5e7eb;border-radius:99px;overflow:hidden;margin-bottom:12px}
.ty4-pbar i{display:block;height:100%;width:0;background:#3b82f6;border-radius:99px;transition:width .2s}

/* ---------- 手指提示 ---------- */
.ty4-promptrow{display:flex;align-items:center;gap:14px;padding:0 4px;margin-bottom:10px}
.ty4-targetkey{display:inline-flex;justify-content:center;align-items:center;width:52px;height:52px;
  flex-shrink:0;border:3px solid;border-radius:12px;color:#fff;font-size:26px;font-weight:800;
  text-shadow:1px 1px 3px rgba(0,0,0,.3);transition:all .3s}
.ty4-fingerhint{font-size:14px;color:#374151}
.ty4-fingerhint strong{color:#3b82f6}
.ty4-keyname{color:#f59e0b;font-size:16px}
.ty4-hicon{font-style:normal;margin-right:2px}
.ty4-hintrow{text-align:center;padding:8px 0 12px}
.ty4-hinttxt{color:#9ca3af;font-size:14px}

/* ---------- 完成 / 星级 ---------- */
.ty4-stars{display:flex;gap:6px;justify-content:center;margin-bottom:6px}
.ty4-stars span{color:#d1d5db;font-size:34px;line-height:1}
.ty4-stars span.lit{color:#f59e0b;text-shadow:0 2px 8px rgba(245,158,11,.45)}
.ty4-stars span.pop{animation:ty4pop .45s cubic-bezier(.34,1.56,.64,1) backwards}
@keyframes ty4pop{0%{opacity:0;transform:scale(0) rotate(-30deg)}100%{opacity:1;transform:scale(1) rotate(0)}}
.ty4-complete{color:#059669;font-size:18px;font-weight:600;display:block;margin-bottom:8px}
.ty4-fail{color:#d97706;font-size:18px;font-weight:600;display:block;margin-bottom:8px}
.ty4-actions2{display:flex;justify-content:center;gap:10px;margin-top:8px}

/* ---------- 键盘（PracticeKeyboard） ---------- */
.ty4-kbwrap{margin-top:6px;overflow-x:auto;overflow-y:hidden;padding-bottom:4px}
.ty4-kb{position:relative;display:flex;flex-direction:column;gap:4px;background:#f0f2f5;
  border-radius:12px;padding:12px;max-width:800px;margin:0 auto;
  user-select:none;-webkit-user-select:none}
.ty4-kbwrap .ty4-kb{min-width:560px}
.ty4-kbr{display:flex;justify-content:center;gap:4px}
.ty4-k{position:relative;display:flex;justify-content:center;align-items:center;min-width:0;height:44px;
  padding:0 2px;background:#fff;border:1px solid #d1d5db;border-radius:6px;color:#374151;
  font-size:12px;font-weight:500;transition:all .15s;cursor:default}
.ty4-kl{text-align:center;font-size:12px;line-height:1;pointer-events:none}
.ty4-k.mod{background:#e5e7eb;color:#6b7280;font-size:10px}
.ty4-k.space .ty4-kl{font-size:0}
.ty4-k.hl{font-weight:700;transform:scale(1.02)}
.ty4-shift{position:absolute;top:2px;right:3px;font-size:9px;font-weight:600;line-height:1;
  opacity:.6;pointer-events:none}
.ty4-k.correct{background:#dbeafe!important;border-color:#3b82f6!important;color:#1e40af!important}
.ty4-k.wrong{background:#fee2e2!important;border-color:#f87171!important;color:#991b1b!important;
  animation:ty4shake .3s}
@keyframes ty4shake{0%,100%{transform:translate(0)}25%{transform:translate(-3px)}75%{transform:translate(3px)}}

/* ---------- 手部覆盖层（KeyboardHands） ---------- */
.ty4-hands{position:absolute;left:0;top:0;width:100%;height:100%;overflow:visible;
  pointer-events:none;z-index:3}
.ty4-hands .hand-fill{fill:rgba(255,255,255,.55);stroke:#8b929c;stroke-width:2px}
.ty4-hands .palm-line{fill:none;stroke:#8b929c;stroke-width:1.6px;opacity:.45}
.ty4-hands .finger-outline{fill:none;stroke:#8b929c;stroke-linecap:round}
.ty4-hands .finger-core{fill:none;stroke:#f3f4f6;stroke-linecap:round}
.ty4-hands .knuckle{fill:none;stroke:#8b929c;stroke-width:1.4px;opacity:.5}
.ty4-hands .finger-outline.active{stroke:#fff}
.ty4-hands .press-dot{animation:ty4pulse 1s ease-in-out infinite}
@keyframes ty4pulse{0%,100%{opacity:.95}50%{opacity:.45}}

/* ---------- 底部导航 ---------- */
.ty4-nav{display:flex;justify-content:space-between;gap:8px;margin-top:10px}
.ty4-foot{margin-top:8px;font-size:12px;color:var(--sub)}

@media(max-width:820px){
  .ty4-stats{grid-template-columns:repeat(2,1fr)}
  .ty4-pill{width:28px;height:28px;font-size:13px}
  .ty4-targetkey{width:44px;height:44px;font-size:22px}
}

/* ---------- 指法要领：坐姿与手型 对照图（2026-10-24） ---------- */
.tyg-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:12px}
@media (max-width:760px){.tyg-grid{grid-template-columns:1fr}}
.tyg-card{margin:0;border:1px solid var(--line,#e5e7eb);border-radius:14px;overflow:hidden;
  background:#fff;box-shadow:0 1px 2px rgba(16,24,40,.04)}
.tyg-card img{display:block;width:100%;height:auto;background:#f6f7ff}
.tyg-card .cap{display:block;padding:9px 12px 11px}
.tyg-card .cap b{display:block;font-size:14px;font-weight:700;margin-bottom:3px}
.tyg-card .cap .d{display:block;font-size:12.5px;line-height:1.55;color:var(--sub,#8a90a8)}
.tyg-card.ok{border-color:#bbe3cd}
.tyg-card.ok .cap b{color:#1f9d63}
.tyg-card.bad{border-color:#f6d3c6}
.tyg-card.bad .cap b{color:#e2603c}

/* ---------- 文字输入：汉字提示 ---------- */
.ty4-cnhint{font-size:19px;font-weight:700;color:#1f2937;text-align:center;letter-spacing:6px;
  padding:0 0 8px}

/* ---------- 指法要领：看一看选一选（2026-10-24） ---------- */
.tyg-q{margin-top:14px}
.tyg-qt{font-size:13.5px;font-weight:600;color:#1f2937;margin-bottom:8px}
.tyg-card{position:relative;cursor:pointer;transition:box-shadow .2s,transform .15s,opacity .2s}
.tyg-card:hover{box-shadow:0 6px 16px rgba(91,108,255,.2);transform:translateY(-2px)}
.tyg-card .cap{visibility:hidden}
.tyg-card.picked{cursor:default}
.tyg-card.picked .cap{visibility:visible}
.tyg-card.picked:hover{transform:none;box-shadow:0 1px 2px rgba(16,24,40,.04)}
.tyg-card.ok{border-color:#7fd1a5;box-shadow:0 0 0 2px #7fd1a5}
.tyg-card.dim{opacity:.5;filter:saturate(.65)}
.tyg-badge{position:absolute;top:8px;left:8px;width:26px;height:26px;border-radius:50%;
  background:rgba(31,36,51,.72);color:#fff;font-weight:700;font-size:14px;
  display:flex;align-items:center;justify-content:center}
.tyg-fb{margin-top:10px;border-radius:12px;padding:10px 12px;font-size:13px;line-height:1.65}
.tyg-fb.ok{background:#eafaf1;border:1px solid #bfe8cf;color:#16794c}
.tyg-fb.bad{background:#fff2ee;border:1px solid #f6d3c6;color:#b7472a}
.tyg-fb .tyg-again{margin-top:8px}
.tyg-points-t{margin-top:18px;font-size:13.5px;font-weight:700;color:#1f2937}

/* ---------- 关卡：一次性显示全部训练字母（2026-10-24） ---------- */
.ty4-letters .ty4-line.is-cur{background:rgba(91,108,255,.07);border-radius:10px;
  box-shadow:inset 0 0 0 1px rgba(91,108,255,.12)}
.ty4-letters::-webkit-scrollbar{height:8px}
.ty4-letters::-webkit-scrollbar-track{background:transparent}
.ty4-letters::-webkit-scrollbar-thumb{background:#d7dbea;border-radius:8px}

/* ---------- 指法要领：对照要点动图卡片（2026-10-24） ---------- */
.tyg-anims{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:12px;margin-top:10px}
.tyg-anim{display:flex;flex-direction:column;border:1px solid var(--line,#e5e7eb);border-radius:14px;
  background:#fff;overflow:hidden;box-shadow:0 1px 2px rgba(16,24,40,.04)}
.tyg-anim-pic{background:#f6f7ff;border-bottom:1px solid #eef0f7}
.tyg-anim-pic img{display:block;width:100%;height:auto}
.tyg-anim-txt{padding:9px 12px 11px}
.tyg-anim-txt b{display:block;font-size:14px;font-weight:700;margin-bottom:3px;color:#1f2937}
.tyg-anim-txt .muted{font-size:12.5px;line-height:1.55;color:var(--sub,#8a90a8)}

/* ---------- 指法要领：十指分工彩色图（2026-10-24） ---------- */
.tyg-fingers{margin-top:12px;padding:10px 10px 2px;background:#fff;border:1px solid #e5e7eb;
  border-radius:14px;overflow-x:auto}
.tyg-fingers img{display:block;width:100%;height:auto;min-width:680px}
.tyg-fingers .cap{display:block;padding:6px 4px 8px;font-size:12.5px;color:#8a90a8}

/* ---------- 中英文文字模式：汉字/单词 + 拼音/字母（2026-10-24 v8） ---------- */
.ty4-letters.mode-txt{height:70px;padding:22px 16px 0}
.ty4-letters.mode-txt.mode-cn{height:84px;padding:20px 16px 0}
.ty4-letters.mode-txt .ty4-line{gap:0}
.ty4-word{display:inline-flex;flex-direction:column;align-items:center;justify-content:flex-end;
  gap:1px;margin:0 4px;padding:1px 3px;border-radius:8px;transition:background .2s}
.ty4-word.ty4-spw{margin:0 1px}
.ty4-word.done{background:rgba(16,185,129,.08)}
.ty4-word.cur{background:rgba(59,130,246,.10)}
.ty4-cn{font-family:"KaiTi","STKaiti","Kaiti SC","楷体",serif;font-style:normal;line-height:20px;
  font-size:19px;font-weight:700;color:#c7cdd8;letter-spacing:1px;transition:all .2s}
.ty4-word.done .ty4-cn{color:#0f9d63}
.ty4-word.cur .ty4-cn{color:#1d4ed8}
.ty4-wordtxt{display:inline-flex;align-items:baseline;line-height:1.25}
.ty4-ch{display:inline-block;min-width:12px;text-align:center;border-radius:5px;
  font-family:"Courier New","Consolas",monospace;font-size:16px;font-weight:500;
  color:#9aa3b2;transition:all .18s}
.ty4-letters.mode-txt:not(.mode-cn) .ty4-ch{
  font-family:"Segoe UI",system-ui,-apple-system,"PingFang SC",sans-serif;
  font-size:20px;font-weight:500;min-width:9px;letter-spacing:.2px}
.ty4-ch.done{color:#0f9d63;font-weight:700}
.ty4-ch.cur{color:#1d4ed8;font-weight:800;background:#dbeafe;box-shadow:0 0 0 2px #93c5fd inset}
.ty4-ch.cur.bad{color:#dc2626;background:#fee2e2;box-shadow:0 0 0 2px #fca5a5 inset}
.ty4-ch.ty4-sp{min-width:9px;font-size:13px;color:#cbd5e1}
.ty4-ch.ty4-sp.done{color:#a7f3d0}
.ty4-ch.ty4-sp.cur{color:#1d4ed8}
.ty4-pill.cur.bad{background:#fee2e2;border-color:#f87171;color:#991b1b;animation:ty4shake .3s}
/* 竖向留白压缩：让文字与键盘同屏 */
.ty4-promptrow{margin-bottom:8px}
.ty4-hintrow{padding:6px 0 9px}
.ty4-pbar{margin-bottom:10px}
@media(max-width:820px){
  .ty4-letters.mode-txt{height:64px;padding:19px 16px 0}
  .ty4-letters.mode-txt.mode-cn{height:76px;padding:17px 16px 0}
  .ty4-ch{font-size:14px;min-width:11px}
  .ty4-cn{font-size:17px;line-height:18px}
  .ty4-letters.mode-txt:not(.mode-cn) .ty4-ch{font-size:17px}
}

/* v9 通关询问弹窗 */
.ty4-modalmsg{text-align:center;font-size:17px;font-weight:600;color:#065f46;margin:4px 0 10px}
.ty4-modalscore{text-align:center;color:#475569;font-size:14px;margin-bottom:8px}
.ty4-modalscore b{color:#1d4ed8;font-size:16px}
.ty4-modalnext{text-align:center;font-size:14px;color:#334155;background:#f1f5f9;border-radius:10px;padding:9px 12px;margin-top:6px}
.ty4-modalnext b{color:#1d4ed8}
.modal .ft .btn{min-width:128px}

/* v10 通关积分行 */
.ty4-points{display:flex;justify-content:center;align-items:center;gap:18px;margin:8px auto 4px;
  background:linear-gradient(90deg,#fff7ed,#fef3c7);border:1px solid #fcd34d;border-radius:12px;
  padding:10px 16px;font-size:15px;color:#92400e;max-width:480px;flex-wrap:wrap}
.ty4-points.dim{background:#f8fafc;border-color:#e2e8f0;color:#64748b}
.ty4-points .ty4-pt-now b{color:#d97706;font-size:18px;font-weight:800;margin-left:2px}
.ty4-points.dim .ty4-pt-now b{color:#64748b}
.ty4-points .ty4-pt-total b{color:#1d4ed8;font-weight:800;margin-left:2px}
.ty4-hintrow .ty4-points{margin-top:4px}
