/* typing_practice.css - V8 PRO */
:root{
    --tp-bg:#eef2f7;
    --tp-surface:#ffffff;
    --tp-surface-2:#f8fafc;
    --tp-surface-3:#f1f5f9;
    --tp-text:#0f172a;
    --tp-muted:#64748b;
    --tp-line:#dbe3ee;
    --tp-line-strong:#c7d2e0;
    --tp-primary:#2563eb;
    --tp-primary-2:#1d4ed8;
    --tp-primary-soft:#eaf1ff;
    --tp-success:#16a34a;
    --tp-success-soft:#ecfdf3;
    --tp-danger:#dc2626;
    --tp-danger-soft:#fff1f2;
    --tp-left:#7c3aed;
    --tp-left-soft:#f3efff;
    --tp-right:#0891b2;
    --tp-right-soft:#ecfbff;
    --tp-warning:#d97706;
    --tp-shadow:0 18px 50px rgba(15,23,42,.08);
    --tp-shadow-soft:0 8px 24px rgba(15,23,42,.06);
    --tp-radius:18px;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
    margin:0;
    min-height:100vh;
    background:
        radial-gradient(circle at 10% 0%,rgba(37,99,235,.07),transparent 28rem),
        radial-gradient(circle at 100% 0%,rgba(8,145,178,.05),transparent 24rem),
        var(--tp-bg);
    color:var(--tp-text);
    font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
}
button,select,textarea,input{font:inherit}
button,select{cursor:pointer}
button:focus-visible,select:focus-visible,textarea:focus-visible,input:focus-visible{
    outline:3px solid rgba(37,99,235,.18);
    outline-offset:2px;
}

/* Top bar */
.tp-topbar{
    position:sticky;
    top:0;
    z-index:70;
    display:flex;
    align-items:center;
    gap:16px;
    min-height:68px;
    padding:9px clamp(14px,2.2vw,30px);
    border-bottom:1px solid rgba(199,210,224,.85);
    background:rgba(255,255,255,.94);
    backdrop-filter:blur(18px);
    box-shadow:0 3px 18px rgba(15,23,42,.04);
}
.tp-logo{
    flex:0 0 auto;
    display:flex;
    align-items:center;
    gap:10px;
    color:var(--tp-text);
    text-decoration:none;
}
.tp-logo-mark{
    width:42px;height:42px;
    display:grid;place-items:center;
    border-radius:12px;
    background:#0f172a;color:#fff;
    font-weight:900;letter-spacing:-.05em;
}
.tp-logo-copy{min-width:0}
.tp-logo-copy strong{display:block;font-size:15px;line-height:1.1;white-space:nowrap}
.tp-logo-copy strong em{
    margin-left:4px;
    padding:2px 5px;
    border-radius:5px;
    background:var(--tp-primary);
    color:#fff;
    font-size:9px;
    font-style:normal;
    letter-spacing:.08em;
}
.tp-logo-copy small{display:block;margin-top:3px;color:var(--tp-muted);font-size:9.5px;white-space:nowrap}
.tp-toolbar{
    min-width:0;
    flex:1;
    display:flex;
    align-items:flex-end;
    justify-content:flex-end;
    gap:7px;
}
.tp-field{display:grid;gap:4px;min-width:0}
.tp-field>span{
    padding-left:2px;
    color:var(--tp-muted);
    font-size:9px;
    font-weight:800;
    letter-spacing:.06em;
    text-transform:uppercase;
}
.tp-field select{
    height:39px;
    border:1px solid var(--tp-line);
    border-radius:10px;
    background:#fff;
    color:var(--tp-text);
    padding:0 32px 0 10px;
    font-size:11.5px;
    font-weight:700;
}
.tp-field-lesson{flex:0 1 292px}
.tp-field-lesson select{width:100%}
.tp-field-time select{width:92px}
.tp-field-input-mode select{width:164px}
.tp-field-lesson select optgroup{font-weight:900;color:#334155}
.tp-field-lesson select option{font-weight:500;color:#172033}
.tp-switch{
    height:39px;
    display:flex;
    align-items:center;
    gap:6px;
    padding:0 8px;
    border:1px solid var(--tp-line);
    border-radius:10px;
    background:#fff;
    color:var(--tp-muted);
    font-size:10px;
    font-weight:800;
    user-select:none;
}
.tp-switch input{position:absolute;opacity:0;pointer-events:none}
.tp-switch-track{
    position:relative;
    width:30px;height:18px;
    border-radius:999px;
    background:#cbd5e1;
    transition:.18s ease;
}
.tp-switch-track::after{
    content:"";
    position:absolute;left:3px;top:3px;
    width:12px;height:12px;border-radius:50%;
    background:#fff;
    box-shadow:0 1px 3px rgba(0,0,0,.18);
    transition:.18s ease;
}
.tp-switch input:checked+.tp-switch-track{background:var(--tp-primary)}
.tp-switch input:checked+.tp-switch-track::after{transform:translateX(12px)}
.tp-btn{
    height:39px;
    border:1px solid transparent;
    border-radius:10px;
    padding:0 12px;
    font-size:11px;
    font-weight:850;
    white-space:nowrap;
    transition:.15s ease;
}
.tp-btn:hover{transform:translateY(-1px)}
.tp-btn-primary{background:var(--tp-primary);color:#fff;box-shadow:0 6px 14px rgba(37,99,235,.2)}
.tp-btn-primary:hover{background:var(--tp-primary-2)}
.tp-btn-ghost,.tp-btn-secondary{background:#fff;color:var(--tp-text);border-color:var(--tp-line)}
.tp-btn-soft{background:var(--tp-primary-soft);color:var(--tp-primary-2);border-color:#cfe0ff}

/* Workspace */
.tp-shell{
    width:min(1760px,calc(100% - 24px));
    margin:0 auto;
    padding:11px 0 22px;
}
.tp-workspace{
    display:grid;
    grid-template-columns:minmax(0,1fr) 252px;
    gap:11px;
    align-items:start;
}
.tp-main-column{min-width:0;display:grid;gap:11px}
.tp-training-card,.tp-keyboard-card,.tp-side-card,.tp-stat{
    border:1px solid var(--tp-line);
    background:var(--tp-surface);
    box-shadow:var(--tp-shadow-soft);
}
.tp-training-card,.tp-keyboard-card,.tp-side-card{border-radius:var(--tp-radius)}
.tp-training-card{padding:12px}
.tp-training-head{
    display:flex;align-items:center;justify-content:space-between;
    gap:14px;margin-bottom:9px;
}
.tp-title-line{display:flex;align-items:center;gap:8px;font-size:11px}
.tp-live-dot{
    width:8px;height:8px;border-radius:50%;
    background:var(--tp-success);
    box-shadow:0 0 0 4px var(--tp-success-soft);
}
.tp-progress-meta{min-width:230px;display:flex;align-items:center;gap:8px}
.tp-progress-meta>span{width:34px;text-align:right;color:var(--tp-muted);font-size:10px;font-weight:900}
.tp-progress{height:7px;flex:1;overflow:hidden;border-radius:999px;background:#e8edf4}
.tp-progress span{display:block;width:0;height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--tp-primary),#38bdf8);transition:width .18s ease}

/* Practice frame */
.tp-target-wrap{
    position:relative;
    height:190px;
    overflow:hidden;
    display:flex;
    flex-direction:column;
    justify-content:center;
    border:1px solid var(--tp-line-strong);
    border-radius:15px;
    background:linear-gradient(180deg,#fff 0%,#fbfdff 100%);
    padding:14px 18px;
    cursor:text;
    box-shadow:inset 0 1px 0 #fff;
}
.tp-target-wrap.is-focused{
    border-color:#94b7ff;
    box-shadow:0 0 0 4px rgba(37,99,235,.08),inset 0 1px 0 #fff;
}
.tp-target-line{
    width:100%;
    font-family:"SFMono-Regular",Consolas,"Liberation Mono",monospace;
    font-size:clamp(26px,2.15vw,35px);
    line-height:1.62;
    letter-spacing:.018em;
    word-break:break-word;
    user-select:none;
}
.tp-char{border-radius:5px;transition:.08s ease}
.tp-char.correct{color:#8b97a8}
.tp-char.done{color:#8b97a8}
.tp-char.wrong{
    color:var(--tp-danger);
    background:var(--tp-danger-soft);
    text-decoration:underline 2px;
}
.tp-char.current{
    color:#0f172a;
    background:#dfeaff;
    box-shadow:inset 0 -3px 0 var(--tp-primary);
}
.tp-char.current.space-char::after{
    content:"␣";color:var(--tp-primary);font-size:.68em
}
.tp-hidden-input{
    position:absolute;left:10px;bottom:8px;
    width:1px;height:1px;opacity:.01;border:0;resize:none
}
.tp-vietnamese-preview{
    width:100%;
    margin-bottom:9px;
    padding:8px 10px;
    border:1px solid #d8e7ff;
    border-radius:10px;
    background:#f4f8ff;
}
.tp-vietnamese-preview>span{
    display:block;margin-bottom:3px;
    color:var(--tp-primary);
    font-size:8.5px;font-weight:900;
    text-transform:uppercase;letter-spacing:.08em
}
.tp-vietnamese-preview strong{
    display:block;color:#334155;font-size:12px;line-height:1.45;font-weight:650
}

/* Guidance */
.tp-guidance{
    min-height:49px;
    margin-top:9px;
    display:grid;
    grid-template-columns:42px minmax(0,1fr) auto;
    align-items:center;
    gap:10px;
    padding:7px 9px;
    border:1px solid #dbe7fb;
    border-radius:12px;
    background:#f5f8ff;
}
.tp-current-key{
    width:42px;height:42px;display:grid;place-items:center;
    border-radius:10px;background:var(--tp-primary);color:#fff;
    font-family:Consolas,monospace;font-size:19px;font-weight:900;
    box-shadow:0 6px 12px rgba(37,99,235,.18)
}
.tp-guidance-copy{min-width:0}
.tp-guidance-copy strong{display:block;font-size:11px}
.tp-guidance-copy span{display:block;margin-top:2px;color:var(--tp-muted);font-size:9.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tp-finger-pill{
    padding:5px 8px;border-radius:999px;
    background:#fff;color:var(--tp-primary);
    border:1px solid #d7e5ff;
    font-size:9px;font-weight:900
}
.tp-guidance.is-error{background:var(--tp-danger-soft);border-color:#fecdd3;animation:tpShake .22s linear}
.tp-guidance.is-success{background:var(--tp-success-soft);border-color:#bbf7d0}
@keyframes tpShake{25%{transform:translateX(-3px)}75%{transform:translateX(3px)}}

/* Keyboard */
.tp-keyboard-card{padding:11px 12px 9px}
.tp-card-head{
    display:flex;align-items:center;justify-content:space-between;gap:12px;
    margin-bottom:8px
}
.tp-card-head strong{display:block;font-size:11px}
.tp-card-head span{display:block;margin-top:2px;color:var(--tp-muted);font-size:9px}
.tp-keyboard-meta{display:flex;align-items:center;gap:10px}
.tp-home-badge{
    margin:0!important;padding:5px 7px;border-radius:7px;
    background:#f1f5f9;color:#475569!important;font-size:8.5px!important;font-weight:900
}
.tp-legend{display:flex;gap:9px}
.tp-legend span{display:flex;align-items:center;gap:4px;color:var(--tp-muted);font-size:8.5px}
.legend-dot{width:7px;height:7px;border-radius:50%}
.legend-left{background:var(--tp-left)}.legend-right{background:var(--tp-right)}.legend-active{background:var(--tp-primary)}
.tp-keyboard-stage{
    position:relative;
    min-height:312px;
    overflow:hidden;
    border:1px solid #dce4ee;
    border-radius:15px;
    background:
        linear-gradient(180deg,#f8fafc 0%,#f1f5f9 100%);
    padding:10px 10px 25px;
}
.tp-keyboard{position:relative;z-index:2;display:grid;gap:6px;width:100%}
.tp-keyboard-row{display:flex;gap:6px;width:100%}
.tp-key{
    position:relative;
    min-width:0;
    flex:1 1 0;
    height:clamp(42px,3.25vw,58px);
    display:grid;place-items:center;
    border:1px solid #cfd8e5;
    border-bottom-width:3px;
    border-radius:9px;
    background:#fff;color:#1e293b;
    font-size:clamp(10px,.9vw,14px);font-weight:900;
    user-select:none;
    box-shadow:0 2px 0 rgba(15,23,42,.03);
    transition:.1s ease
}
.tp-key.left-hand{background:linear-gradient(180deg,#fff,#f7f2ff);border-color:#d9ceef}
.tp-key.right-hand{background:linear-gradient(180deg,#fff,#effbfe);border-color:#c7e4eb}
.tp-key.space-key{flex:6.4 1 0}
.tp-key.wide-1{flex:1.55 1 0}
.tp-key.wide-2{flex:2 1 0}
.tp-key.is-active{
    z-index:5;
    color:#fff;background:var(--tp-primary);border-color:var(--tp-primary);
    box-shadow:0 0 0 4px rgba(37,99,235,.12),0 8px 18px rgba(37,99,235,.18);
    transform:translateY(1px)
}
.tp-key.is-pressed{transform:translateY(2px);border-bottom-width:1px}
.tp-key.is-wrong{background:var(--tp-danger);border-color:var(--tp-danger);color:#fff;animation:tpShake .2s}
.tp-key .finger-code{
    position:absolute;right:4px;bottom:2px;
    color:#94a3b8;font-size:6.5px;font-weight:800
}
.hide-key-labels .tp-key .key-label{opacity:.08}
.hide-key-labels .tp-key.is-active .key-label,.hide-key-labels .tp-key:hover .key-label{opacity:1}

/* Hands overlay */
.tp-hands-overlay{
    position:absolute;
    z-index:3;
    inset:0;
    pointer-events:none;
}
.tp-hand-svg{
    position:absolute;
    top:5%;
    width:min(44%,660px);
    height:94%;
    overflow:visible;
    opacity:.30;
    filter:drop-shadow(0 8px 10px rgba(15,23,42,.08))
}
.tp-hand-svg-left{left:4.5%}
.tp-hand-svg-right{right:4.5%}
.tp-palm-shape rect,.tp-palm-shape path,.tp-hand-finger rect,.tp-hand-thumb ellipse{
    fill:#cbd5e1;
    stroke:#64748b;
    stroke-width:2;
}
.tp-palm-shape text{fill:#64748b;font-size:16px;font-weight:900;text-anchor:middle}
.tp-hand-finger,.tp-hand-thumb{
    transform:translate(var(--finger-dx,0),var(--finger-dy,0));
    transform-box:fill-box;
    transform-origin:center bottom;
    transition:transform .18s ease,opacity .18s ease
}
.tp-hand-finger.is-active rect,.tp-hand-thumb.is-active ellipse,
.tp-hands-overlay [data-finger].is-active rect,.tp-hands-overlay [data-finger].is-active ellipse{
    fill:#3b82f6;stroke:#1d4ed8;stroke-width:3
}
.tp-hands-overlay [data-finger].is-active{opacity:1;filter:drop-shadow(0 5px 10px rgba(37,99,235,.28))}
.tp-fingertip-anchor{fill:transparent;stroke:none}
.tp-finger-guide{
    position:absolute;z-index:6;height:2px;
    transform-origin:left center;
    background:linear-gradient(90deg,rgba(37,99,235,.9),rgba(37,99,235,.15));
    opacity:0;pointer-events:none
}
.tp-key-target-dot{
    position:absolute;z-index:7;
    width:8px;height:8px;margin:-4px 0 0 -4px;
    border-radius:50%;background:var(--tp-primary);
    box-shadow:0 0 0 5px rgba(37,99,235,.13);
    opacity:0;pointer-events:none
}
.tp-home-hint{
    display:flex;align-items:center;justify-content:center;gap:5px;
    padding-top:6px;color:var(--tp-muted);font-size:8px
}
.tp-home-hint b{
    min-width:21px;height:20px;display:grid;place-items:center;
    border:1px solid var(--tp-line);border-radius:5px;background:#fff;color:#475569
}
.tp-home-hint i{color:var(--tp-primary)}
.tp-home-hint small{margin-left:5px}

/* Side rail */
.tp-side-column{
    position:sticky;
    top:79px;
    display:grid;
    gap:9px;
}
.tp-stats{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:7px
}
.tp-stat{
    min-height:76px;
    padding:10px;
    border-radius:13px
}
.tp-stat>span{display:block;color:var(--tp-muted);font-size:8.5px;font-weight:800;text-transform:uppercase;letter-spacing:.04em}
.tp-stat>div{display:flex;align-items:baseline;gap:4px;margin-top:6px}
.tp-stat strong{font-size:24px;letter-spacing:-.04em}
.tp-stat small{color:var(--tp-muted);font-size:8px;font-weight:800}
.tp-stat-primary{
    border-color:#bdd2ff;
    background:linear-gradient(180deg,#fff,#f2f7ff)
}
.tp-stat-primary strong{color:var(--tp-primary)}
.tp-side-card{padding:11px}
.tp-side-label,.tp-section-label{
    color:var(--tp-primary);font-size:8px;font-weight:900;letter-spacing:.08em;text-transform:uppercase
}
.tp-finger-status-card>strong{display:block;margin-top:4px;font-size:20px;letter-spacing:-.03em}
.tp-finger-route{
    margin-top:7px;padding:7px 8px;border:1px solid var(--tp-line);border-radius:9px;background:#f8fafc
}
.tp-finger-route span{font-family:Consolas,monospace;color:var(--tp-primary);font-size:11px;font-weight:900}
.tp-finger-status-card p{margin:7px 0 0;color:var(--tp-muted);font-size:9px;line-height:1.45}
.tp-performance-row{display:grid;grid-template-columns:repeat(3,1fr);gap:5px}
.tp-performance-row>div{text-align:center;padding:7px 3px;border:1px solid var(--tp-line);border-radius:9px;background:#fff}
.tp-performance-row span,.tp-performance-row strong{display:block}
.tp-performance-row span{font-size:8px;color:var(--tp-muted)}
.tp-performance-row strong{font-size:17px;margin-top:2px}
.tp-tip-card{margin-top:7px;padding:9px;border-radius:10px;background:#f8fafc;border:1px solid #edf2f7}
.tp-tip-card strong{display:block;font-size:10px}
.tp-tip-card p{margin:3px 0 0;font-size:8.8px;line-height:1.45;color:var(--tp-muted)}
.tp-weak-button{
    width:100%;height:32px;margin-top:7px;
    border:1px dashed #b7c3d3;border-radius:9px;
    background:#fff;color:var(--tp-primary);font-size:9px;font-weight:900
}

/* Existing modal system */
.tp-modal[hidden],.tp-custom-backdrop[hidden]{display:none!important}
.tp-modal{
    position:fixed;inset:0;z-index:120;
    display:grid;place-items:center;padding:18px
}
.tp-modal>.tp-modal-backdrop{
    position:absolute;inset:0;background:rgba(15,23,42,.58);backdrop-filter:blur(5px)
}
.tp-modal-card{
    position:relative;z-index:1;
    width:min(720px,100%);max-height:86vh;overflow:auto;
    border:1px solid var(--tp-line);border-radius:18px;background:#fff;
    padding:19px;box-shadow:0 28px 80px rgba(15,23,42,.25)
}
.tp-modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.tp-modal-head h2{margin:3px 0 0;font-size:22px}
.tp-eyebrow{color:var(--tp-primary);font-size:8px;font-weight:900;letter-spacing:.09em}
.tp-close,.tp-modal-close{
    width:36px;height:36px;display:grid;place-items:center;
    border:1px solid var(--tp-line);border-radius:10px;background:#fff;color:var(--tp-text);
    font-size:22px;line-height:1
}
.tp-muted{color:var(--tp-muted);font-size:10px;line-height:1.5}
.tp-heatmap{display:grid;grid-template-columns:repeat(auto-fit,minmax(50px,1fr));gap:7px}
.tp-heat-key{
    min-height:48px;border:1px solid var(--tp-line);border-radius:9px;background:#fff;
    display:grid;place-items:center;padding:4px;color:var(--tp-text)
}
.tp-heat-key strong{font-size:13px}.tp-heat-key small{font-size:8px;color:var(--tp-muted)}
.tp-heat-key.level-1{background:#fff8eb;border-color:#f2d79a}
.tp-heat-key.level-2{background:#fff0e6;border-color:#f3bd8c}
.tp-heat-key.level-3{background:#fff0f0;border-color:#efaaaa}
.tp-heat-key.level-4{background:#ffe1e1;border-color:#e67373}
.tp-modal-actions,.tp-complete-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:14px}
.tp-complete-card{text-align:center;max-width:470px}
.tp-complete-icon{
    width:56px;height:56px;margin:0 auto 10px;display:grid;place-items:center;
    border-radius:50%;background:var(--tp-success-soft);color:var(--tp-success);
    font-size:25px;font-weight:900
}
.tp-complete-card h2{margin:4px 0 6px}.tp-complete-card p{margin:0;color:var(--tp-muted);font-size:11px}
.tp-complete-actions{justify-content:center}

/* Custom text modal */
body.tp-modal-open{overflow:hidden}
.tp-custom-backdrop{
    position:fixed;inset:0;z-index:130;
    display:grid;place-items:center;padding:18px;
    background:rgba(15,23,42,.62);backdrop-filter:blur(6px)
}
.tp-custom-modal{
    width:min(860px,100%);max-height:calc(100vh - 36px);overflow:auto;
    border:1px solid var(--tp-line);border-radius:20px;background:#fff;
    box-shadow:0 30px 90px rgba(15,23,42,.30);padding:22px
}
.tp-custom-modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}
.tp-custom-modal-head h2{margin:4px 0 0;font-size:24px;letter-spacing:-.025em}
.tp-custom-help{margin:13px 0 10px;color:var(--tp-muted);font-size:12px;line-height:1.55}
.tp-custom-textarea{
    width:100%;min-height:320px;resize:vertical;
    border:1px solid var(--tp-line-strong);border-radius:14px;
    background:#fbfdff;color:var(--tp-text);padding:15px 16px;
    outline:none;font:500 15px/1.65 Inter,ui-sans-serif,system-ui,sans-serif
}
.tp-custom-textarea:focus{border-color:#94b7ff;box-shadow:0 0 0 4px rgba(37,99,235,.09)}
.tp-custom-textarea.is-error{border-color:var(--tp-danger);box-shadow:0 0 0 4px rgba(220,38,38,.08)}
.tp-custom-meta{display:flex;justify-content:space-between;gap:12px;margin-top:8px;color:var(--tp-muted);font-size:10px}
.tp-custom-meta span:first-child{color:var(--tp-text);font-weight:900}
.tp-custom-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:15px}

/* Full paragraph modes */
.tp-speed-test-mode .tp-target-wrap,
body:has(#lessonSelect option[value="custom"]:checked) .tp-target-wrap{
    height:clamp(260px,37vh,430px);
    overflow-y:auto;
    justify-content:flex-start;
    scrollbar-width:thin
}
.tp-speed-test-mode .tp-target-line,
body:has(#lessonSelect option[value="custom"]:checked) .tp-target-line{
    font-size:clamp(21px,1.65vw,29px);
    line-height:1.72;
    white-space:pre-wrap
}
.tp-speed-test-mode .tp-vietnamese-preview{
    max-height:160px;overflow-y:auto
}
.tp-vietnamese-target{white-space:pre-wrap}

/* Responsive */
@media (min-width:1600px){
    .tp-workspace{grid-template-columns:minmax(0,1fr) 270px}
    .tp-target-wrap{height:220px}
    .tp-keyboard-stage{min-height:350px}
    .tp-hand-svg{width:min(45%,720px)}
}
@media (max-width:1220px){
    .tp-logo-copy small{display:none}
    .tp-toolbar{gap:5px}
    .tp-field>span,.tp-switch-text{display:none}
    .tp-field-lesson{flex:1}
    .tp-field-input-mode select{width:150px}
    .tp-workspace{grid-template-columns:minmax(0,1fr) 225px}
}
@media (max-width:980px){
    .tp-topbar{position:relative;flex-wrap:wrap}
    .tp-toolbar{width:100%;justify-content:flex-start}
    .tp-workspace{grid-template-columns:1fr}
    .tp-side-column{position:static;grid-template-columns:1.3fr 1fr 1.3fr}
    .tp-stats{grid-template-columns:repeat(4,1fr)}
    .tp-keyboard-stage{min-height:300px}
}
@media (max-width:760px){
    .tp-topbar{padding:8px 9px}
    .tp-logo-copy small{display:none}
    .tp-toolbar{flex-wrap:wrap}
    .tp-field-lesson{order:1;flex-basis:100%}
    .tp-field-lesson select{width:100%}
    .tp-field-time,.tp-field-input-mode{order:2}
    .tp-switch{order:3}
    .tp-btn{order:4}
    .tp-shell{width:calc(100% - 10px);padding-top:6px}
    .tp-target-wrap{height:190px;padding:12px}
    .tp-target-line{font-size:22px;line-height:1.58}
    .tp-guidance{grid-template-columns:38px minmax(0,1fr)}
    .tp-finger-pill{display:none}
    .tp-current-key{width:38px;height:38px}
    .tp-side-column{grid-template-columns:1fr}
    .tp-finger-status-card,.tp-performance-card{display:none}
    .tp-keyboard-card{padding:8px 5px}
    .tp-card-head{align-items:flex-start}
    .tp-keyboard-meta{display:none}
    .tp-keyboard-stage{min-height:250px;overflow-x:auto;padding:5px 3px 16px}
    .tp-keyboard{min-width:690px}
    .tp-hands-overlay{min-width:690px;width:690px;left:0;right:auto}
    .tp-finger-guide,.tp-key-target-dot{display:none}
    .tp-home-hint small{display:none}
    .tp-custom-textarea{min-height:260px}
    .tp-custom-meta{flex-direction:column;gap:3px}
    .tp-custom-actions{flex-direction:column-reverse}
    .tp-custom-actions .tp-btn{width:100%}
}
@media (max-width:460px){
    .tp-logo{display:none}
    .tp-toolbar{justify-content:space-between}
    .tp-field-time select{width:86px}
    .tp-field-input-mode select{width:145px}
    .tp-switch{padding:0 6px}
    .tp-btn{padding:0 9px}
    .tp-btn-soft{flex:1}
    .tp-stats{grid-template-columns:1fr 1fr}
    .tp-progress-meta{min-width:120px}
    .tp-training-head{align-items:flex-start}
    .tp-title-line strong{font-size:10px}
    .tp-guidance-copy span{display:none}
}
@media (max-height:760px) and (min-width:981px){
    .tp-topbar{min-height:60px;padding-top:6px;padding-bottom:6px}
    .tp-shell{padding-top:7px}
    .tp-target-wrap{height:150px}
    .tp-target-line{font-size:24px;line-height:1.48}
    .tp-guidance{min-height:42px;margin-top:7px}
    .tp-current-key{width:34px;height:34px;font-size:16px}
    .tp-keyboard-stage{min-height:224px;padding-top:7px}
    .tp-key{height:36px}
    .tp-hand-svg{height:95%;width:44%}
    .tp-side-card{padding:8px}
    .tp-stat{min-height:67px;padding:8px}
    .tp-stat strong{font-size:21px}
    .tp-speed-test-mode .tp-target-wrap,
    body:has(#lessonSelect option[value="custom"]:checked) .tp-target-wrap{
        height:245px
    }
    .tp-speed-test-mode .tp-target-line,
    body:has(#lessonSelect option[value="custom"]:checked) .tp-target-line{
        font-size:21px;line-height:1.55
    }
}
@media (prefers-reduced-motion:reduce){
    *,*::before,*::after{scroll-behavior:auto!important;transition:none!important;animation:none!important}
}
