/* typing.css — Tập gõ phím */
.tp-wrap { max-width: 920px; margin: 0 auto; padding: 28px 20px 80px; }
.tp-hero { text-align: center; padding: 10px 0 18px; }
.tp-hero h1 { font-size: clamp(1.6rem,4vw,2.3rem); font-weight: 800; letter-spacing: -.02em; }
.tp-hero h1 span { color: var(--brand); }
.tp-hero p { color: var(--ink-soft); margin-top: 6px; font-size: .95rem; }

/* Level chips */
.lv-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0 6px; }
.lv-chip {
  padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 999px;
  background: #fff; cursor: pointer; font-weight: 600; font-size: .85rem; transition: all .15s;
}
.lv-chip:hover:not(:disabled) { border-color: var(--brand); }
.lv-chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.lv-chip.locked { opacity: .5; cursor: not-allowed; }

/* Level info */
.lv-info { text-align: center; margin: 16px 0 8px; }
.lv-info h2 { font-size: 1.15rem; font-weight: 700; }
.lv-info p { color: var(--ink-soft); font-size: .88rem; margin-top: 3px; }

/* Audio bar (level 6) */
.audio-bar { display: none; justify-content: center; gap: 10px; margin: 10px 0; }

/* Stats */
.tp-stats { display: flex; justify-content: center; gap: 28px; margin: 12px 0; }
.tp-stats div { text-align: center; font-size: .78rem; color: var(--ink-mute); font-weight: 600; }
.tp-stats div span { display: block; font-size: 1.3rem; font-weight: 800; color: var(--ink); }
.tp-stats .stat-acc span { color: var(--brand); }

/* Text display */
.type-area { cursor: text; }
.type-display {
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 22px 24px; font-size: 1.5rem; line-height: 2.1; letter-spacing: .5px;
  font-family: 'Courier New', monospace; min-height: 80px; word-break: break-word;
}
.tc { color: var(--ink-mute); border-radius: 3px; }
.tc-ok { color: var(--brand); }
.tc-bad { color: #fff; background: #e53e3e; }
.tc-cur { background: #ffe9a8; box-shadow: 0 2px 0 #f0b400; }
.type-hidden { color: var(--ink-soft); font-family: inherit; font-size: 1.05rem; }

/* Input ẩn */
.type-input {
  width: 100%; margin-top: 14px; padding: 12px 16px; font-size: 1.05rem;
  border: 1.5px solid var(--line); border-radius: 12px; font-family: inherit;
}
.type-input:focus { outline: none; border-color: var(--brand); }

/* Keyboard */
.kb { margin: 22px auto 0; max-width: 720px; user-select: none; }
.kb-row { display: flex; justify-content: center; gap: 6px; margin-bottom: 6px; }
.kb-key {
  width: 46px; height: 46px; border-radius: 8px; display: grid; place-items: center;
  background: #fff; border: 1.5px solid var(--line); font-weight: 600; font-size: .9rem;
  color: var(--ink); box-shadow: 0 2px 0 rgba(0,0,0,.06); transition: all .08s;
}
.kb-space { width: 280px; font-size: .8rem; color: var(--ink-mute); }
.kb-key.next {
  background: var(--brand); color: #fff; border-color: var(--brand);
  transform: translateY(1px); box-shadow: 0 0 0 3px rgba(21,163,90,.25);
}
/* màu theo ngón */
.finger-lp, .finger-rp { background: #fde4ec; }
.finger-lr, .finger-rr { background: #fff1d6; }
.finger-lm, .finger-rm { background: #e0f0ff; }
.finger-li, .finger-ri { background: #e2f7e8; }
.finger-thumb { background: #eee9ff; }
.kb-key.next { background: var(--brand) !important; color:#fff; }

.finger-hint { text-align: center; margin-top: 12px; font-weight: 700; color: var(--brand); min-height: 22px; }
.kb-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 16px; margin-top: 12px; font-size: .72rem; color: var(--ink-mute); }
.kb-legend span { display: inline-flex; align-items: center; gap: 5px; }
.kb-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* Result */
.tp-result {
  display: none; margin: 18px auto 0; max-width: 460px; text-align: center;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; padding: 22px;
}
.tr-title { font-size: 1.2rem; font-weight: 800; margin-bottom: 14px; }
.tr-stats { display: flex; justify-content: center; gap: 24px; margin-bottom: 16px; }
.tr-stats div { font-size: .76rem; color: var(--ink-mute); font-weight: 600; }
.tr-stats div span { display: block; font-size: 1.5rem; font-weight: 800; color: var(--brand); }
.tr-actions { display: flex; gap: 10px; justify-content: center; }

.tp-toolbar { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }

@media (max-width: 640px) {
  .kb-key { width: 30px; height: 36px; font-size: .72rem; gap: 4px; }
  .kb-space { width: 160px; }
  .type-display { font-size: 1.15rem; line-height: 1.9; }
  .tp-stats { gap: 18px; }
}

/* Popup hỏi đáp án (Level 5) */
.tp-modal {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.45); align-items: center; justify-content: center;
}
.tp-modal.show { display: flex; }
.tp-modal-box {
  background: #fff; border-radius: 18px; padding: 26px 28px; width: 90%; max-width: 360px;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.tp-modal-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 10px; }
.tp-modal-q { font-size: 1.8rem; font-weight: 800; color: var(--brand); margin-bottom: 16px; font-family: 'Courier New', monospace; }
.tp-modal-input {
  width: 100%; padding: 12px 14px; font-size: 1.2rem; text-align: center;
  border: 1.5px solid var(--line); border-radius: 12px; font-family: inherit; margin-bottom: 8px;
}
.tp-modal-input:focus { outline: none; border-color: var(--brand); }
.tp-modal-msg { min-height: 22px; font-size: .85rem; font-weight: 600; margin-bottom: 10px; }
.tp-modal-msg.ok { color: var(--brand); }
.tp-modal-msg.no { color: #e53e3e; }

/* phase badge cho level 5 */
.tp-phase { text-align: center; font-weight: 700; font-size: .82rem; color: var(--ink-mute); margin-bottom: 6px; min-height: 18px; }
.math-q { color: var(--ink); font-weight: 700; }
.demo-typing { color: var(--ink-soft); }

/* Giấy chứng nhận */
.cert-box { max-width: 560px; }
.cert-preview { width: 100%; border-radius: 10px; border: 1px solid var(--line); margin: 8px 0 12px; }

/* Dòng đếm người nhận */
.cert-count {
  background: #fff7e6; border: 1.5px solid #f0c040; color: #b8860b;
  border-radius: 10px; padding: 8px 12px; font-weight: 700; font-size: .92rem; margin-bottom: 12px;
}
/* Khu vực kiểm tra giấy chứng nhận */
.verify-zone {
  max-width: 560px; margin: 24px auto 60px; text-align: center;
  background: var(--surface); border: 1.5px dashed var(--line); border-radius: 16px; padding: 22px;
}
.verify-zone h3 { font-size: 1.05rem; font-weight: 700; }
.verify-zone p { font-size: .85rem; color: var(--ink-soft); margin: 6px 0 12px; }
.verify-result { margin-top: 14px; padding: 12px 14px; border-radius: 10px; font-size: .9rem; line-height: 1.5; }
.verify-result.ok { background: #d8f3e3; color: #0d7a40; }
.verify-result.no { background: #fde2e2; color: #c53030; }

/* Dòng cảnh báo dưới khu vực quét */
.verify-notice {
  max-width: 560px; margin: 0 auto 60px; text-align: center;
  font-size: .82rem; line-height: 1.55; color: #b8860b; font-weight: 600;
  background: #fff8ec; border: 1px solid #f0e0b8; border-radius: 12px; padding: 12px 16px;
}

/* Nút đóng popup */
.tp-modal-box { position: relative; }
.tp-modal-x {
  position: absolute; top: 10px; right: 12px; width: 32px; height: 32px;
  border: none; background: #f0f0f0; border-radius: 50%; cursor: pointer;
  font-size: 1rem; color: #555; line-height: 1; transition: all .15s;
}
.tp-modal-x:hover { background: #e53e3e; color: #fff; }
