/* CSS dùng chung cho module Luyện gõ tiếng Nhật — đồng bộ design system classplus.io.vn. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
:root {
  --tp-bg: #faf8f3;          /* ngà ấm như ClassPlus */
  --tp-bg-light: #f2efe7;
  --tp-panel: #ffffff;
  --tp-ink: #1a1a24;
  --tp-secondary: #54545f;
  --tp-muted: #8c8c97;
  --tp-primary: #4361ee;
  --tp-primary-d: #3a0ca3;
  --tp-purple: #7209b7;
  --tp-accent: #06d6a0;      /* success/teal */
  --tp-pink: #f72585;
  --tp-ok: #06d6a0;
  --tp-bad: #ef476f;
  --tp-warn: #c98a00;
  --tp-border: #e8e3d8;
  --tp-soft: #f6f3ec;
  --tp-gradient: linear-gradient(135deg, #4361ee 0%, #7209b7 100%);
  --tp-radius: 16px;
  --tp-shadow: 0 4px 16px rgba(17,17,26,.07);
  --tp-shadow-lg: 0 12px 36px rgba(17,17,26,.10);
}
* { box-sizing: border-box; }
body.tp-body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--tp-bg);
  color: var(--tp-ink);
  min-height: 100vh;
}
.tp-wrap { max-width: 960px; margin: 0 auto; padding: 18px 16px 60px; }
.tp-header {
  display: flex; align-items: center; gap: 14px; color: #fff;
  background: var(--tp-gradient); border-radius: var(--tp-radius);
  padding: 18px 22px; margin-bottom: 18px; box-shadow: var(--tp-shadow-lg);
}
.tp-header .tp-logo { font-size: 28px; }
.tp-header h1 { font-size: 21px; margin: 0; font-weight: 800; letter-spacing: -.01em; }
.tp-header .tp-sub { color: rgba(255,255,255,.85); font-size: 13px; margin-top: 2px; }
.tp-header .tp-nav { margin-left: auto; display: flex; gap: 8px; }
.tp-card {
  background: var(--tp-panel); border-radius: var(--tp-radius); padding: 20px;
  box-shadow: var(--tp-shadow); margin-bottom: 16px; border: 1px solid #f0ece2;
}
.tp-card h2 { font-size: 16px; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.tp-label { font-size: 13px; color: var(--tp-muted); font-weight: 600; margin-bottom: 6px; display: block; }
.tp-input {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--tp-border);
  border-radius: 10px; font-size: 15px; color: var(--tp-ink); background: #fff;
}
.tp-input:focus { outline: none; border-color: var(--tp-primary); box-shadow: 0 0 0 3px rgba(67,97,238,.15); }
.tp-row { display: flex; gap: 10px; flex-wrap: wrap; }
.tp-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: none; border-radius: 10px; padding: 11px 18px; font-size: 14px; font-weight: 700;
  background: var(--tp-gradient); color: #fff; transition: .15s; text-decoration: none;
  box-shadow: 0 4px 14px rgba(67,97,238,.25);
}
.tp-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.tp-btn.ghost { background: #fff; color: var(--tp-primary-d); box-shadow: none; border: 1.5px solid #e0d9ff; }
.tp-btn.ghost:hover { background: #f5f2ff; }
.tp-btn.accent { background: linear-gradient(135deg, #06d6a0 0%, #118ab2 100%); box-shadow: 0 4px 14px rgba(6,214,160,.25); }
.tp-btn.danger { background: #fee2e8; color: var(--tp-bad); box-shadow: none; }
.tp-btn.lg { padding: 14px 26px; font-size: 16px; }
.tp-btn:disabled { opacity: .5; cursor: not-allowed; }
.tp-muted { color: var(--tp-muted); font-size: 13px; }
.tp-hidden { display: none !important; }

/* Chọn độ khó */
.tp-diff-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tp-diff {
  border: 1.5px solid var(--tp-border); border-radius: 12px; padding: 14px 10px; text-align: center;
  cursor: pointer; background: #fff; transition: .15s; font-weight: 600;
}
.tp-diff:hover { border-color: var(--tp-primary); }
.tp-diff.active { border-color: var(--tp-primary); background: #f0edff; color: var(--tp-primary-d); }
.tp-diff .tp-diff-ic { font-size: 22px; display: block; margin-bottom: 6px; }

/* Danh sách bài */
.tp-ex-list { display: grid; gap: 10px; }
.tp-ex {
  display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--tp-border);
  border-radius: 12px; padding: 12px 14px; cursor: pointer; background: #fff; transition: .15s;
}
.tp-ex:hover { border-color: var(--tp-accent); background: #f0fdfa; }
.tp-ex .tp-ex-main { flex: 1; min-width: 0; }
.tp-ex .tp-ex-title { font-weight: 700; }
.tp-ex .tp-ex-vi { color: var(--tp-muted); font-size: 13px; }
.tp-ex .tp-ex-meta { font-size: 12px; color: var(--tp-muted); white-space: nowrap; }

/* Khu vực gõ */
.tp-stage { text-align: center; }
.tp-target {
  font-size: 34px; line-height: 1.9; letter-spacing: 2px; word-break: break-all;
  padding: 18px; background: var(--tp-soft); border-radius: 14px; margin-bottom: 8px; min-height: 80px;
}
.tp-target .k { padding: 0 1px; border-radius: 4px; }
.tp-target .k.done { color: var(--tp-ok); }
.tp-target .k.cur { background: #fde68a; color: #92400e; box-shadow: 0 0 0 2px #f59e0b inset; }
.tp-target .k.todo { color: #94a3b8; }
.tp-target .k.bad { background: #fecaca; }
.tp-romaji { font-size: 17px; color: var(--tp-muted); min-height: 24px; letter-spacing: 1px; }
.tp-romaji .typed { color: var(--tp-ok); font-weight: 700; }
.tp-romaji .next { color: var(--tp-primary); font-weight: 700; }

/* Bảng chỉ số */
.tp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.tp-stat { background: var(--tp-soft); border-radius: 12px; padding: 12px 8px; text-align: center; }
.tp-stat .v { font-size: 24px; font-weight: 800; color: var(--tp-ink); }
.tp-stat .l { font-size: 12px; color: var(--tp-muted); margin-top: 2px; }
.tp-stat.time .v { color: var(--tp-primary); }
.tp-progress { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; margin: 6px 0 0; }
.tp-progress > i { display: block; height: 100%; background: var(--tp-accent); width: 0; transition: width .12s; }

/* Hai bàn tay 10 ngón */
.tp-hands { text-align: center; margin-top: 8px; }
.tp-hands svg { width: 100%; max-width: 330px; height: auto; }
.tp-hands .fg { stroke: #cbd5e1; stroke-width: 1.5; transition: .12s; transform-box: fill-box; transform-origin: center bottom; }
.tp-hands .palm { fill: #efe9dd; stroke: #cbd5e1; stroke-width: 1.5; }
.tp-hands .fg-active { stroke: var(--tp-primary); stroke-width: 3.5; filter: drop-shadow(0 0 7px rgba(67,97,238,.65)); transform: translateY(-6px) scale(1.08); }

/* Gợi ý ngón + bàn phím ảo */
.tp-finger { font-size: 14px; margin: 6px 0 2px; min-height: 22px; color: var(--tp-ink); }
.tp-finger b { padding: 2px 10px; border-radius: 99px; }
.tp-kb-scroll { overflow-x: auto; padding: 6px 0; }
.tp-kb { display: inline-flex; flex-direction: column; gap: 6px; align-items: center; margin: 8px auto 0; min-width: 540px; }
.tp-kb-row { display: flex; gap: 6px; }
.tp-key {
  width: 40px; height: 42px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; border: 1px solid #cbd5e1; font-size: 14px; color: #334155; transition: .1s;
}
.tp-key.space { width: 260px; }
.tp-key.next { outline: 3px solid var(--tp-warn); box-shadow: 0 0 0 4px #fde68a; transform: translateY(2px); color: #92400e; z-index: 2; }
.tp-key.hit { background: var(--tp-ok) !important; color: #fff; }
/* màu theo ngón */
.f-lp { background: #fee2e2; } .f-lr { background: #ffedd5; } .f-lm { background: #fef9c3; } .f-li { background: #dcfce7; }
.f-ri { background: #cffafe; } .f-rm { background: #dbeafe; } .f-rr { background: #ede9fe; } .f-rp { background: #fce7f3; }
.f-th { background: #e2e8f0; }
.tp-kb-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; margin-top: 10px; font-size: 11px; color: var(--tp-muted); }
.tp-kb-legend span { display: inline-flex; align-items: center; gap: 4px; }
.tp-kb-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid #cbd5e1; }

/* Kết quả */
.tp-result-score { font-size: 56px; font-weight: 900; color: var(--tp-primary); text-align: center; }
.tp-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 99px; font-weight: 700; font-size: 14px; }
.tp-badge.pass { background: #dcfce7; color: var(--tp-ok); }
.tp-badge.fail { background: #fef3c7; color: var(--tp-warn); }
.tp-share { display: flex; gap: 8px; margin-top: 10px; }
.tp-share input { flex: 1; }

/* Bảng (BXH, lịch sử, admin) */
.tp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tp-table th, .tp-table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--tp-border); }
.tp-table th { color: var(--tp-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tp-table tr:hover td { background: var(--tp-soft); }
.tp-rank { font-weight: 800; width: 44px; text-align: center; }
.tp-rank.top1 { color: #ca8a04; } .tp-rank.top2 { color: #64748b; } .tp-rank.top3 { color: #b45309; }
.tp-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tp-tab { padding: 8px 14px; border-radius: 99px; border: 1.5px solid var(--tp-border); cursor: pointer; font-weight: 600; font-size: 13px; background: #fff; }
.tp-tab.active { background: var(--tp-primary); color: #fff; border-color: var(--tp-primary); }
.tp-pill { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: #f0edff; color: var(--tp-primary-d); font-weight: 700; }
.tp-empty { text-align: center; color: var(--tp-muted); padding: 28px; }
.tp-foot { text-align: center; color: #94a3b8; font-size: 12px; margin-top: 24px; }

@media (max-width: 640px) {
  .tp-diff-grid { grid-template-columns: repeat(2, 1fr); }
  .tp-stats { grid-template-columns: repeat(2, 1fr); }
  .tp-target { font-size: 27px; }
  .tp-header h1 { font-size: 17px; }
}
