/* typing-practice 전용. 자판 그림(.board .key)·고르기(.chips)는 /assets/site.css */

/* 설정: 한 줄의 작은 묶음 버튼 */
.tp-ui .tp-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.tp-ui .tp-seg { margin: 0; gap: 0; }
.tp-ui .tp-seg label + label span { margin-left: -1px; }
.tp-ui .tp-seg span { min-height: 38px; border-radius: 0; }
.tp-ui .tp-seg label:first-of-type span { border-radius: 2px 0 0 2px; }
.tp-ui .tp-seg label:last-of-type span { border-radius: 0 2px 2px 0; }
.tp-ui .tp-aud { margin-left: auto; }
.tp-ui .tp-aud span { font-size: 13px; min-height: 34px; }
.tp-ui .tp-levels { margin-top: 10px; }
.tp-ui .tp-levels legend { font-size: 13px; }
.tp-ui .tp-levels span { min-height: 32px; font-size: 13px; padding: 0 10px; }
.tp-ui .tp-touch { margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--seal); }

/* 타자 칸: 화면의 주인공 */
.tp-ui .tp-stage { position: relative; margin-top: 14px; border: 1px solid var(--rule); border-top: 3px solid var(--ink); background: var(--paper); min-height: 250px; display: flex; flex-direction: column; }
.tp-ui .tp-head { display: flex; align-items: baseline; gap: 22px; padding: 10px 16px 6px; }
.tp-ui .tp-stat { display: inline-flex; align-items: baseline; gap: 6px; }
.tp-ui .tp-stat b { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; min-width: 1.5em; }
.tp-ui .tp-stat i { font-style: normal; font-size: 12.5px; color: var(--ink-3); }
.tp-ui .tp-prog { margin-left: auto; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.tp-ui .tp-progbar { height: 3px; background: var(--rule-soft); }
.tp-ui .tp-progbar i { display: block; height: 100%; width: 0; background: var(--seal); transition: width .2s; }
.tp-ui .tp-body { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 38px 20px 8px; text-align: center; }

/* 낱말·문장: 친 글자는 먹, 남은 글자는 흐리게, 지금 글자에 커서 */
.tp-ui .tp-target { margin: 0; max-width: 100%; font-size: clamp(28px, 5vw, 42px); line-height: 1.4; font-weight: 700; letter-spacing: 0.01em; word-break: keep-all; overflow-wrap: anywhere; }
.tp-ui .tp-target:empty { display: none; }
.tp-ui .tp-target .c { color: var(--ink-3); opacity: 0.5; }
.tp-ui .tp-target .c.done { color: var(--ink); opacity: 1; }
.tp-ui .tp-target .c.now { position: relative; color: var(--seal); opacity: 1; }
.tp-ui .tp-target .c.now::before { content: ""; position: absolute; left: -2px; top: 12%; bottom: 12%; width: 2px; background: var(--seal); animation: tp-caret 1s steps(1) infinite; }
.tp-ui .tp-target .c.now.typing::before { display: none; }
.tp-ui .tp-target .c.now.typing { box-shadow: inset 0 -3px 0 var(--seal); }
.tp-ui .tp-target .c.now.typing::after { content: attr(data-part); position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); padding: 1px 6px; font-size: 0.5em; line-height: 1.3; color: var(--paper); background: var(--seal); border-radius: 3px; white-space: nowrap; }
.tp-ui .tp-target .c.empty { color: var(--seal); opacity: 0.45; }
.tp-ui .tp-target .c.err { text-decoration: underline wavy var(--danger); text-underline-offset: 7px; }
.tp-ui .tp-target.shake { animation: tp-shake .22s; }
.tp-ui .tp-next { margin: 14px 0 0; min-height: 1.4em; font-size: 16px; color: var(--ink-3); }
@keyframes tp-caret { 50% { opacity: 0; } }
@keyframes tp-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* 자리: 키캡 줄. 가운데 큰 키가 지금 칠 키 */
.tp-ui .tp-caps { display: flex; align-items: center; justify-content: center; gap: 10px; }
.tp-ui .tp-caps:empty { display: none; }
.tp-ui .cap { display: grid; place-items: center; width: 52px; height: 52px; font-size: 24px; font-weight: 700; color: var(--ink-3); border: 1px solid var(--rule); border-bottom-width: 3px; border-radius: 6px; background: var(--paper-2); }
.tp-ui .cap.done { opacity: 0.35; }
.tp-ui .cap.now { width: 104px; height: 104px; font-size: 52px; color: var(--ink); border: 2px solid var(--seal); border-bottom-width: 5px; background: var(--paper); position: relative; }
.tp-ui .cap.now small { position: absolute; left: 8px; top: 5px; font-size: 13px; font-weight: 700; color: var(--ink-3); }
.tp-ui .tp-caps.shake .cap.now { animation: tp-shake .22s; border-color: var(--danger); }

.tp-ui .tp-guide { margin: 0; padding: 10px 16px 14px; min-height: 1.6em; font-size: 15px; color: var(--ink-2); text-align: center; }
.tp-ui .tp-guide strong { color: var(--seal); font-size: 19px; }
.tp-ui .tp-focus { position: absolute; left: 0; right: 0; bottom: 44px; margin: 0; text-align: center; font-size: 14px; font-weight: 700; color: var(--seal); }

/* 결과: 타자 칸 위를 덮는다 */
.tp-ui .tp-done { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; background: var(--paper); text-align: center; }
.tp-ui .tp-done-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink-2); }
.tp-ui .tp-done-big { display: flex; align-items: baseline; gap: 8px; }
.tp-ui .tp-done-big b { font-size: 64px; line-height: 1; font-weight: 800; letter-spacing: -0.03em; }
.tp-ui .tp-done-big span { font-size: 15px; color: var(--ink-3); }
.tp-ui .tp-done dl { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; margin: 0; }
.tp-ui .tp-done dl div { display: flex; gap: 6px; align-items: baseline; }
.tp-ui .tp-done dt { font-size: 13px; color: var(--ink-3); }
.tp-ui .tp-done dd { margin: 0; font-size: 16px; font-weight: 700; }
.tp-ui .tp-done .row { gap: 8px; justify-content: center; margin-top: 6px; }

/* 자판: 다음 키만 인주색. 한글 연습이면 자모를 크게 */
.tp-ui .board { margin-top: 14px; }
.tp-ui .board.ko .key .j { align-self: center; margin-top: auto; font-size: 1.7cqw; font-weight: 700; color: var(--ink); }
.tp-ui .board.ko .key .l { font-size: 0.85cqw; color: var(--ink-3); }
.tp-ui .board.ko .key .j { margin-bottom: 0.5cqw; }
.tp-ui .board .key.home::after { bottom: 5%; left: 40%; right: 40%; }
.tp-ui .key { transition: none; }
.tp-ui .key.next { background: var(--seal); border-color: var(--seal); color: var(--seal-ink); }
.tp-ui .key.next .j, .tp-ui .key.next .l { color: var(--seal-ink); }
.tp-ui .key.next-shift { background: var(--seal-soft); border-color: var(--seal); }
.tp-ui .key.finger { box-shadow: inset 0 0 0 0.25cqw var(--seal-soft); border-color: var(--seal); border-style: dashed; }
.tp-ui .key.hit { background: var(--ink); border-color: var(--ink); }
.tp-ui .key.hit .j, .tp-ui .key.hit .l { color: var(--paper); }
.tp-ui .key.miss { animation: tp-miss .3s; }
.tp-ui .key.missed { box-shadow: inset 0 0 0 0.3cqw var(--danger); }
@keyframes tp-miss { 0%, 70% { background: var(--danger); border-color: var(--danger); } }

.tp-ui .tp-tip { margin: 12px 0 0; font-size: 15px; color: var(--ink-2); text-align: center; }
.tp-ui .tp-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--ink-3); }
.tp-ui .jb-link { padding: 0; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 700; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 32px; }
.tp-ui .jb-link:hover { color: var(--seal); }

/* 어린이: 더 크게, 시간 숨김. 어르신: 가장 크게, 속도·시간 숨김 */
.tp-ui[data-aud="kids"] .tp-target { font-size: clamp(34px, 7vw, 54px); }
.tp-ui[data-aud="kids"] .st-time { display: none; }
.tp-ui[data-aud="senior"] .tp-target { font-size: clamp(38px, 8vw, 60px); }
.tp-ui[data-aud="senior"] .st-speed, .tp-ui[data-aud="senior"] .st-time { display: none; }
.tp-ui[data-aud="senior"] .tp-guide { font-size: 18px; }
.tp-ui[data-aud="senior"] .tp-guide strong { font-size: 26px; }
.tp-ui[data-aud="senior"] .cap.now, .tp-ui[data-aud="kids"] .cap.now { width: 128px; height: 128px; font-size: 64px; }

@media (max-width: 520px) {
  .tp-ui .tp-aud { margin-left: 0; }
  .tp-ui .tp-head { gap: 14px; }
  .tp-ui .cap { width: 40px; height: 40px; font-size: 18px; }
  .tp-ui .cap.now { width: 84px; height: 84px; font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .tp-ui .tp-target .c.now::before, .tp-ui .tp-target.shake, .tp-ui .tp-caps.shake .cap.now, .tp-ui .key.miss { animation: none; }
}
