/* 기존 사이트의 네이비·청록 토큰을 사용하는 다국어 연습 화면. */
.tp-page { max-width: 920px; --tp-ok: color-mix(in srgb, var(--teal) 55%, var(--navy)); --tp-error: color-mix(in srgb, var(--red) 72%, var(--navy)); }
.tp-card { padding: 24px; border: 1px solid var(--line-strong); border-radius: var(--r-l); background: var(--surface); }
.tp-card h2 { margin: 0 0 12px; font-size: 24px; }
.tp-card p { margin-bottom: 20px; color: var(--ink-2); }
.tp-page .btn--primary { color: var(--surface); }
.tp-page .tp-stage { position: relative; padding: 24px; isolation: isolate; border: 1px solid var(--line-strong); border-top: 5px solid var(--navy); border-radius: var(--r-l); background: var(--surface-2); box-shadow: var(--sh-2); }
.tp-stage [hidden] { display: none !important; }
.tp-stage-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.tp-play-label { display: inline-flex; align-items: center; gap: 8px; color: var(--navy); font-size: 13px; font-weight: 800; }
.tp-play-label::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.tp-stage-heading a { font-size: 12px; color: var(--ink-2); text-underline-offset: 4px; }
.tp-language-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 24px; }
.tp-language-nav a { padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface); font-size: 13px; font-weight: 700; color: var(--ink-2); }
.tp-language-nav a[aria-current="page"] { color: var(--surface); border-color: var(--navy); background: var(--navy); }
.tp-ready-script { color: var(--teal); font-size: 18px; font-weight: 800; margin: 0 0 16px; }
.tp-stage .tp-ready h2 { font-size: clamp(20px, 4vw, 28px); line-height: 1.5; margin-bottom: 10px; }
.tp-input-guide { margin: 20px auto 0; max-width: 600px; font-size: 13px; line-height: 1.7; text-align: center; color: var(--ink-2); }
.tp-page .tp-guide { max-width: none; margin-top: 56px; padding: 28px; border: 1px solid var(--line-strong); border-radius: var(--r-l); background: var(--surface); scroll-margin-top: 90px; }
.tp-guide-heading { display: flex; align-items: center; gap: 12px; padding-bottom: 24px; border-bottom: 1px solid var(--line-strong); margin-bottom: 24px; }
.tp-guide-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 18px; font-weight: 800; color: var(--ink-2); }
.tp-guide-heading #tpGuideTitle { margin: 0 0 2px; font-size: 20px; }
.tp-guide-heading p { margin: 0; font-size: 13px; }
.tp-guide-heading a { margin-left: auto; flex: none; font-size: 12px; }
.tp-hub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.tp-language-card { display: flex; flex-direction: column; min-width: 0; padding: 26px; border: 1px solid var(--line-strong); border-radius: var(--r-l); background: var(--surface); box-shadow: var(--sh-1); transition: border-color .18s, transform .18s; }
.tp-language-card:hover { border-color: var(--teal); transform: translateY(-3px); }
.tp-language-script { color: var(--teal); font-size: 20px; font-weight: 800; margin-bottom: 20px; }
.tp-language-card h2 { font-size: 22px; margin: 0 0 10px; }
.tp-language-card p { font-size: 14px; line-height: 1.7; color: var(--ink-2); margin: 0 0 12px; }
.tp-language-card .tp-language-sample { margin-top: auto; padding-top: 8px; color: var(--ink); }
.tp-language-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--line-strong); font-size: 12px; color: var(--ink-2); }
.tp-language-bottom b { color: var(--navy); }
.tp-language-bottom { align-items: center; }
.tp-language-counts { display: grid; gap: 6px; }
.tp-language-counts strong { color: var(--ink); font-size: 13px; }
.tp-language-counts small { font-size: 11px; line-height: 1.5; }
.tp-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line-strong); padding-bottom: 16px; }
.tp-segments { display: flex; gap: 4px; padding: 4px; background: color-mix(in srgb, var(--navy) 6%, var(--bg)); border-radius: var(--r-m); }
.tp-segments button, .tp-effects, .tp-abort { font: inherit; font-weight: 700; border: 0; cursor: pointer; color: var(--ink-2); }
.tp-segments button { min-height: 48px; padding: 10px 22px; border-radius: 12px; background: transparent; }
.tp-segments [aria-pressed="true"] { background: var(--navy); color: var(--surface); box-shadow: var(--sh-1); }
.tp-segments button:disabled { cursor: default; }
.tp-feedback-controls { margin-left: auto; display: flex; flex-wrap: wrap; gap: 0 10px; align-items: center; }
.tp-effects, .tp-sound { min-height: 44px; background: transparent; padding: 8px; font: inherit; font-size: 13px; font-weight: 700; border: 0; color: var(--ink-2); cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.tp-sound::before { content: '♪'; display: inline-block; margin-right: 5px; color: var(--tp-ok); text-decoration: none; }
.tp-sound[aria-pressed="false"]::before { color: var(--ink-2); }
.tp-effects::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--tp-ok); }
.tp-effects[aria-pressed="false"]::before { background: var(--ink-2); }
.tp-ready { padding: 48px 0 12px; text-align: center; }
.tp-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.tp-start { min-height: 64px; min-width: 200px; font-size: 24px; box-shadow: var(--sh-2); }
.tp-meta { font-size: 14px; color: var(--ink-2); line-height: 1.7; }
.tp-hud { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; padding-top: 18px; font-size: 12px; font-variant-numeric: tabular-nums; }
.tp-progress-wrap { flex: 1 1 180px; color: var(--ink-2); }
.tp-progress-track { height: 7px; margin-top: 7px; background: var(--line-strong); border-radius: var(--r-pill); overflow: hidden; }
.tp-progress-track i { display: block; height: 100%; background: var(--tp-ok); transform: scaleX(0); transform-origin: left; transition: transform .32s ease-out; }
.tp-combo { flex: 0 0 92px; display: flex; align-items: center; gap: 5px; color: var(--tp-ok); }
.tp-combo svg { width: 22px; height: 22px; fill: currentColor; }
.tp-combo b { font-size: 28px; min-width: 2ch; }
.tp-combo span { max-width: 2em; line-height: 1.2; font-size: 11px; }
.tp-stat { display: grid; gap: 1px; color: var(--ink-2); }
.tp-stat b { font-size: 20px; color: var(--ink); display: inline-block; width: 6ch; }
.tp-abort { min-height: 44px; padding: 6px 0; background: transparent; text-decoration: underline; text-underline-offset: 4px; font-size: 12px; }
.tp-target-bay { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 320px; padding: 22px 0; text-align: center; scroll-margin-top: 16px; }
.tp-target-bay::before { content: ''; position: absolute; inset: 5% 0; z-index: -1; pointer-events: none; border-radius: 50%; background: radial-gradient(ellipse, color-mix(in srgb, var(--teal) 19%, transparent), transparent 68%); opacity: 0; transition: opacity .3s; }
.tp-stage[data-heat="1"] .tp-target-bay::before { opacity: .4; }
.tp-stage[data-heat="2"] .tp-target-bay::before { opacity: .7; }
.tp-stage[data-heat="3"] .tp-target-bay::before { opacity: 1; }
.tp-stage[data-mode="sentences"] .tp-target-bay { min-height: 360px; }
.tp-target-label { color: var(--ink-2); font-size: 12px; margin-bottom: 12px; }
.tp-target, .tp-word-exit { margin: 0; font-size: clamp(3rem, 12vw, 7rem); line-height: 1.3; font-weight: 800; letter-spacing: -.035em; white-space: pre; }
.tp-stage[data-mode="sentences"] .tp-target, .tp-stage[data-mode="sentences"] .tp-word-exit { font-size: clamp(1.35rem, 3.4vw, 2rem); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; }
.tp-stage:not([data-language="korean"])[data-mode="words"] .tp-target,
.tp-stage:not([data-language="korean"])[data-mode="words"] .tp-word-exit { max-width: 100%; font-size: clamp(2rem, 9vw, 4.5rem); white-space: pre-wrap; overflow-wrap: anywhere; }
.tp-char { display: inline-block; position: relative; color: var(--ink-2); }
.tp-char.tp-correct { color: var(--tp-ok); font-weight: 900; }
.tp-char.tp-wrong { color: var(--tp-error); text-decoration: underline wavy; text-underline-offset: .12em; text-decoration-thickness: .055em; background: color-mix(in srgb, var(--red) 9%, var(--bg)); }
.tp-char.tp-composing { background: color-mix(in srgb, var(--navy) 9%, var(--bg)); border-radius: 4px; text-decoration: underline dotted; text-underline-offset: .12em; }
.tp-char.tp-current::after { content: ''; position: absolute; height: .055em; min-height: 3px; bottom: -.07em; left: 5%; right: 5%; background: var(--navy); border-radius: 2px; }
/* 이어 쓰는 문자에는 인라인 조판을 유지하고 자간·개별 글자 변형을 적용하지 않는다. */
.tp-target:is(:lang(ar), :lang(hi), :lang(bn)),
.tp-word-exit:is(:lang(ar), :lang(hi), :lang(bn)),
.tp-input:is(:lang(ar), :lang(hi), :lang(bn)) { letter-spacing: normal; line-height: 1.8; }
.tp-target:is(:lang(ar), :lang(hi), :lang(bn)) .tp-char { display: inline; position: static; font-weight: inherit; }
.tp-target:is(:lang(ar), :lang(hi), :lang(bn)) .tp-current::after { content: none; }
.tp-target:is(:lang(ar), :lang(hi), :lang(bn)) .tp-current { text-decoration: underline; text-underline-offset: .18em; }
.tp-word-exit { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--tp-ok); opacity: 0; pointer-events: none; }
.tp-combo-popup { position: absolute; inset: 150px 0 auto; height: 120px; z-index: 4; display: grid; place-items: center; color: var(--tp-ok); font-size: clamp(24px, 6vw, 44px); font-weight: 900; opacity: 0; pointer-events: none; text-shadow: 0 2px 12px var(--surface); }
.tp-input-card { position: relative; padding: 20px 24px 16px; border: 2px solid var(--line-strong); border-radius: var(--r-l); background: var(--surface); box-shadow: var(--sh-2); }
.tp-input-card:focus-within { border-color: var(--tp-ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 13%, transparent), var(--sh-2); }
.tp-input-card::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: color-mix(in srgb, var(--red) 18%, transparent); opacity: 0; pointer-events: none; }
.tp-input-card.tp-has-error { border-color: var(--tp-error); }
.tp-input-card.tp-has-error::after { opacity: .25; }
.tp-error-flash { position: absolute; inset: 0; border-radius: inherit; background: color-mix(in srgb, var(--red) 22%, transparent); opacity: 0; pointer-events: none; }
.tp-input { display: block; width: 100%; min-width: 0; min-height: 64px; padding: 10px 14px; font: inherit; font-size: clamp(24px, 5vw, 32px); text-align: center; color: var(--ink); border: 2px solid var(--line-strong); border-radius: var(--r-s); background: var(--surface-2); caret-color: var(--tp-ok); scroll-margin-block: 180px 20px; }
.tp-page :focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.tp-input:focus { border-color: var(--tp-ok); outline: 3px solid color-mix(in srgb, var(--blue) 75%, var(--navy)); outline-offset: 4px; }
.tp-help { margin-top: 16px; color: var(--ink-2); text-align: center; font-size: 13px; line-height: 1.5; }
.tp-status { min-height: 1.6em; margin-top: 14px; color: var(--ink-2); text-align: center; font-size: 13px; }
.tp-stage #tpResult { position: relative; padding: 32px 0 0; text-align: center; }
.tp-result-mark { display: grid; place-items: center; width: 60px; height: 60px; margin: 0 auto 12px; border: 2px solid var(--tp-ok); border-radius: 50%; color: var(--tp-ok); font-size: 34px; font-weight: 900; }
.tp-result-kicker { font-size: 13px; color: var(--tp-ok); font-weight: 800; margin-bottom: 8px; }
.tp-stage h2 { font-size: 28px; }
.tp-record-badge { display: inline-block; margin-top: 16px; padding: 5px 14px; border-radius: var(--r-pill); color: var(--surface); background: var(--navy); font-size: 13px; font-weight: 800; }
.tp-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 24px 0; }
.tp-results div { padding: 18px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-m); background: var(--surface); }
.tp-results div:first-child { grid-column: 1 / -1; background: var(--navy); color: var(--surface); }
.tp-results dt { font-size: 14px; color: var(--ink-2); }
.tp-results div:first-child dt { color: var(--surface); }
.tp-results dd { margin: 8px 0 0; font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tp-results div:first-child dd { font-size: 56px; }
#tpBest, #tpStorageNotice { margin-top: 12px; font-size: 14px; color: var(--ink-2); }
/* 결과 광고의 예약 높이와 요청 조건은 기존과 같다. */
.tp-ad-space { min-height: 520px; padding-top: 1px; }
.tp-ad-space .manual-ad-unit { min-height: 360px; }
.tp-particles { position: absolute; inset: 0; overflow: hidden; border-radius: var(--r-l); pointer-events: none; z-index: 3; }
.tp-particle { position: absolute; left: 50%; top: 220px; width: 7px; height: 10px; border-radius: 2px; background: var(--teal); opacity: 0; }
.tp-particle:nth-child(3n) { background: var(--blue); }
.tp-particle:nth-child(3n + 1) { background: var(--orange); }
.tp-finish-flash { position: fixed; inset: 0; background: color-mix(in srgb, var(--teal) 12%, transparent); opacity: 0; pointer-events: none; z-index: 20; }
.tp-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 14px; }
.tp-table th, .tp-table td { border: 1px solid var(--line-strong); padding: 12px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.tp-table th:first-child { width: 28%; }
.tp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.tp-stage[data-effects="false"] *, .tp-stage[data-effects="false"] *::before, .tp-stage[data-effects="false"] *::after { animation: none !important; transition: none !important; }
.tp-stage[data-effects="false"] .tp-target-bay::before { opacity: 0; }
@media (max-width: 480px) {
  .tp-page .tp-stage { padding: 18px 14px; }
  .tp-language-nav { gap: 5px; margin-bottom: 18px; }
  .tp-language-nav a { padding: 10px 11px; font-size: 12px; }
  .tp-page .tp-guide { margin-top: 40px; padding: 20px 16px; }
  .tp-guide-heading { flex-wrap: wrap; gap: 10px; }
  .tp-guide-heading a { margin-left: 46px; }
  .tp-hub-grid { grid-template-columns: 1fr; gap: 14px; }
  .tp-language-card { padding: 22px; }
  .tp-card { padding: 18px; }
  .tp-toolbar { gap: 6px; padding-bottom: 10px; }
  .tp-segments { flex: 1; }
  .tp-segments button { flex: 1; padding: 8px; font-size: 14px; }
  .tp-feedback-controls { gap: 0 8px; }
  .tp-effects, .tp-sound { padding: 4px 0; font-size: 11px; }
  .tp-hud { gap: 8px 12px; padding-top: 12px; }
  .tp-progress-wrap { flex-basis: calc(100% - 104px); }
  .tp-abort { margin-left: auto; }
  .tp-stat { display: flex; align-items: baseline; gap: 6px; }
  .tp-stat b { font-size: 17px; }
  .tp-combo b { font-size: 25px; }
  .tp-target-bay { min-height: 208px; padding: 16px 0; }
  .tp-stage[data-mode="sentences"] .tp-target-bay { min-height: 360px; }
  .tp-input-card { padding: 16px 16px 14px; border-radius: var(--r-m); }
  .tp-input { min-height: 60px; }
  .tp-help { font-size: 12px; }
  .tp-results { gap: 8px; }
  .tp-results div { padding: 12px 8px; }
  .tp-results dd { font-size: 24px; }
}
/* 화면 키보드가 열린 때에는 목표와 입력을 함께 볼 공간을 줄인다. */
.tp-stage[data-keyboard="true"] .tp-target-bay { min-height: 128px; padding: 8px 0; }
.tp-stage[data-keyboard="true"][data-mode="sentences"] .tp-target-bay { min-height: 260px; }
.tp-stage[data-keyboard="true"][data-mode="sentences"] .tp-target, .tp-stage[data-keyboard="true"][data-mode="sentences"] .tp-word-exit { font-size: 1.125rem; }
.tp-stage[data-keyboard="true"] .tp-target-label { margin-bottom: 4px; }
.tp-stage[data-keyboard="true"] .tp-input-card { padding-block: 12px; }
@media (prefers-reduced-motion: reduce) {
  .tp-stage *, .tp-stage *::before, .tp-stage *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .tp-particles, .tp-word-exit, .tp-finish-flash { display: none; }
}

/* 현재 음절만 전개한다. 다섯 타일까지 한 줄에 두고 높이를 미리 확보한다. */
.tp-jamo { display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 68px; margin-top: 14px; width: 100%; }
.tp-jamo-tile { position: relative; display: grid; place-items: center; box-sizing: border-box; width: 42px; height: 52px; padding-bottom: 8px; border: 2px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink-2); font-size: 25px; line-height: 1; }
.tp-jamo-correct { color: var(--tp-ok); border-color: var(--tp-ok); font-weight: 900; }
.tp-jamo-correct::after { content: '✓'; position: absolute; bottom: 2px; font-size: 12px; }
.tp-jamo-wrong { color: var(--tp-error); font-weight: 800; text-decoration: underline wavy; text-underline-offset: 4px; border-color: var(--tp-error); }
.tp-jamo-wrong::after { content: '×'; position: absolute; bottom: 1px; font-size: 13px; }
.tp-jamo-next { border: 3px solid var(--navy); color: var(--ink); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--navy); }
.tp-mismatch { min-height: 2.8em; margin-top: 12px; font-size: 13px; line-height: 1.4; font-weight: 700; color: var(--tp-error); text-align: center; overflow-wrap: anywhere; }
.tp-status { font-weight: 600; }
@media (max-width: 480px) {
  .tp-mismatch { min-height: 4.2em; }
}

/* 번역 문구의 길이가 늘어나도 좁은 화면 안에서 줄바꿈한다. */
.tp-segments { max-width: 100%; min-width: 0; }
.tp-segments button { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
.tp-guide-heading { flex-wrap: wrap; }
.tp-guide-heading > div { flex: 1 1 140px; min-width: 0; }
.tp-guide-heading a { margin-left: 0; margin-inline-start: auto; }
html:not([lang="ko"]) .tp-combo { flex: 0 1 auto; max-width: 100%; }
html:not([lang="ko"]) .tp-combo span { max-width: 8em; overflow-wrap: anywhere; }
/* 화면 방향과 연습 지문의 방향은 각각 독립적으로 유지한다. */
html[dir="rtl"] .tp-feedback-controls { margin-left: 0; margin-inline-start: auto; }
html[dir="rtl"] .tp-progress-track i { transform-origin: right; }
html[dir="rtl"] .tp-effects::before, html[dir="rtl"] .tp-sound::before { margin-right: 0; margin-inline-end: 6px; }
html[dir="rtl"] .tp-table { text-align: start; }
html[dir="rtl"] .tp-guide :is(ul, ol) { padding-left: 0; padding-inline-start: 24px; }
html[dir="rtl"] .lang-menu { margin-left: 0; margin-inline-start: auto; }
html[dir="rtl"] :is(.lang-menu-list, .mobile-menu-list, .download-menu-list) { right: auto; left: 0; }
html[dir="rtl"] .tp-abort { margin-left: 0; margin-inline-start: auto; }
@media (max-width: 640px) {
  .topic-game-body .lang-menu { flex: 0 1 auto; min-width: 0; }
  .topic-game-body .lang-menu summary { min-width: 0; }
  .topic-game-body .lang-menu-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .topic-game-body .lang-menu summary::after { flex: none; }
}
@media (max-width: 640px) {
  html:not([lang="ko"]) .tp-segments { flex: 1 0 100%; }
  html:not([lang="ko"]) .tp-segments button { overflow-wrap: normal; }
}
