/* The same practice nodes stay inside a native modal so IME and saved state survive. */
.typing-lab .tl-stage-dialog{--tl-prompt-size:30px;width:min(1180px,calc(100vw - 24px));max-width:calc(100vw - 24px);height:calc(100dvh - 24px);max-height:calc(100dvh - 24px);margin:auto;padding:16px 22px;border:1px solid #ccdcf1;border-radius:20px;background:linear-gradient(150deg,#fff,#f2f7ff);color:#18334e;box-shadow:0 28px 100px #102f5466;overflow:hidden}
.typing-lab .tl-stage-dialog[open]{display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:10px}
.typing-lab .tl-stage-dialog::backdrop{background:#0b233db8;backdrop-filter:blur(5px)}
.tl-stage-header{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:40px;border-bottom:1px solid #d9e5f4;padding-bottom:9px}
.tl-stage-header h2{margin:0;font-size:20px;letter-spacing:-.035em}
.tl-stage-header .tl-eyebrow{display:none}
.tl-stage-header p{margin:2px 0 0;font-size:11px;color:#637b96}
.tl-stage-tools{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:7px}
.tl-stage-tools label{display:flex;flex-direction:row;align-items:center;gap:6px;margin:0;font-size:11px;color:#55718e;white-space:nowrap}
.tl-stage-tools select{width:auto;min-height:31px;padding:4px 7px;border:1px solid #ceddf0;border-radius:8px;background:white;font-size:12px}
.tl-stage-tools button,.tl-stage-header .icon-btn{min-height:32px;padding:6px 10px;font-size:12px;border:1px solid #ceddf0;border-radius:8px;background:white;color:#264d77;cursor:pointer}
.tl-stage-tools button:focus-visible{outline:3px solid #87b9f5;outline-offset:2px}
.tl-stage-body{display:grid;grid-template-rows:auto minmax(68px,1fr) auto auto;align-content:start;gap:7px;min-width:0;min-height:0;overflow:hidden}
.tl-stage-dialog .tl-live-metrics{display:flex;gap:8px;margin:0;justify-content:center;min-height:32px}
.tl-stage-dialog .tl-live-metrics>div{display:flex;align-items:center;justify-content:center;gap:8px;flex:0 1 200px;padding:6px 12px;border:1px solid #dce8f7;border-radius:9px;background:#eef5ff}
.tl-stage-dialog .tl-live-metrics span{display:inline;margin:0;font-size:11px;white-space:nowrap}
.tl-stage-dialog .tl-live-metrics strong{font-size:18px;line-height:1.1;white-space:nowrap}
.tl-stage-dialog .tl-prompt{font-size:var(--tl-prompt-size);line-height:1.6;letter-spacing:.055em;margin:0;padding:10px 18px;min-height:0;max-height:none;border:1px solid #ccddf3;border-radius:12px;background:white;overflow:auto;scroll-padding:16px;outline-offset:-3px}
.tl-stage-dialog .tl-prompt:focus-within{outline:2px solid #70a8ee}
.tl-stage-dialog .tl-prompt span{padding:0 2px}
.tl-stage-dialog .tl-input-dock{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:7px 12px;min-height:28px;font-size:11px;color:#627b97}
.tl-stage-dialog .tl-input-dock label{display:flex!important;flex-direction:row;align-items:center;gap:8px;font-size:11px;font-weight:600;margin:0;white-space:nowrap}
.tl-stage-dialog textarea.tl-ime-input{display:block;width:200px;max-width:38vw;height:29px;min-height:29px;max-height:29px;margin:0;resize:none;overflow:hidden;padding:3px 9px!important;border:1px solid #a9c6ed;border-radius:7px;background:#fff;font-family:inherit;font-size:16px;line-height:21px;white-space:pre;box-shadow:none}
.tl-stage-dialog [data-tl-input-focus]{min-height:28px;padding:4px 10px;font-size:11px}
.tl-stage-dialog textarea.tl-ime-input:focus{border-color:#2d70ce;outline:2px solid #d4e6fc}
.tl-stage-dialog .tl-input-preview{font-size:13px;color:#1c5a9e;max-width:38%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tl-stage-dialog .tl-input-dock .tl-fine,.tl-stage-dialog [data-tl-input-help]{font-size:10px;margin:0;line-height:1.4;max-width:440px}
.tl-stage-dialog .tl-keyboard{margin:0;padding:0;border:0;border-radius:0;background:transparent;min-width:0;max-width:100%}
.tl-stage-dialog .tl-keyboard>summary{display:none}
.tl-stage-dialog .tl-keyboard p.tl-hand-instruction{font-size:12px;line-height:1.5;min-height:18px;margin:0 0 3px;text-align:center}
.tl-stage-dialog .tl-keyboard-surface:not(.tl-numpad-mode){width:min(100%,calc((100dvh - 410px)*1.9231));min-width:0;aspect-ratio:1000/520;margin:0 auto;padding:0;container-type:inline-size}
.tl-stage-dialog .tl-keyboard-surface:not(.tl-numpad-mode) .tl-keyboard-keys{inset:7cqw 0 auto}
.tl-stage-dialog .tl-guide-options{justify-content:center;align-items:center;gap:7px 20px;margin:4px 0 0;padding:6px 10px;border-top:1px solid #dce6f3;font-size:11px}
.tl-stage-dialog .tl-guide-options label{flex-direction:row;font-size:11px;white-space:nowrap}
.tl-stage-dialog .tl-guide-options input{width:16px;height:16px;min-height:16px;padding:0}
.tl-stage-dialog .tl-guide-options select{padding:3px 6px;min-height:27px;max-width:155px;font-size:11px}
.tl-stage-dialog .tl-keyboard>p[data-tl-hand-help]{display:none}
.tl-stage-dialog .tl-keyboard-surface.tl-numpad-mode{width:min(330px,calc((100dvh - 390px)*1.05));max-width:100%;padding:30px 0 62px;margin:0 auto}
.tl-stage-dialog .tl-numpad{grid-template-rows:repeat(5,clamp(24px,calc((100dvh - 480px)/5),42px));gap:4px}
.tl-stage-dialog .tl-numpad kbd{font-size:16px;border-radius:6px}
.tl-stage-dialog .tl-numpad kbd[data-tl-key=Num]{font-size:9px}
.tl-stage-dialog .tl-numpad kbd[data-tl-key=Enter]{font-size:11px}
.tl-stage-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:0;padding-top:7px;border-top:1px solid #d8e4f3}
.tl-stage-footer .tl-practice-buttons{display:flex;gap:7px;flex-wrap:wrap;margin:0;flex-shrink:0}
.tl-stage-footer .btn{min-height:34px;padding:7px 13px;font-size:12px}
.tl-stage-footer .tl-status,.tl-stage-footer .tl-error{font-size:11px;line-height:1.45;margin:0;max-height:42px;overflow:auto}
.tl-stage-footer .tl-goal-result{font-size:12px;font-weight:700;line-height:1.5;color:#206a59;margin:0;max-height:42px;overflow:auto;flex:1 1 200px}
.tl-stage-footer .tl-error:empty,.tl-stage-footer .tl-goal-result:empty{display:none}
.tl-stage-reentry{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:15px 0 4px;padding:16px;background:#eef5ff;border:1px solid #cfe0f7;border-radius:12px}
.tl-stage-reentry p{margin:0;font-size:13px;color:#526e8f}
.tl-session-options{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-top:16px}
.tl-session-options label{display:grid;gap:7px;font-size:13px;font-weight:700;color:#526780}
.tl-session-options small{font-size:10px;font-weight:400;line-height:1.6;color:#71869d}
.tl-start-preview{margin-top:18px;padding:18px 20px;border:1px solid #d1e1f5;border-left:4px solid #4c8ae0;border-radius:13px;background:#f4f8ff}
.tl-start-preview h3{font-size:14px;color:#245389;margin:0 0 9px}
.tl-start-preview [data-tl-preview-prompt]{font-size:22px;line-height:1.7;letter-spacing:.035em;white-space:pre-wrap;overflow-wrap:anywhere;max-height:145px;overflow:auto;margin:0}
.tl-start-preview [role=status],.tl-start-preview small{font-size:11px;line-height:1.6;color:#637b98}
.tl-start-preview [role=alert]{font-size:12px;line-height:1.7;color:#b42318}
@media(max-width:650px){.tl-session-options{grid-template-columns:1fr 1fr;gap:10px}.tl-start-preview{padding:15px}.tl-start-preview [data-tl-preview-prompt]{font-size:20px}}
.tl-stage-dialog:fullscreen{width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border-radius:0;padding:16px 22px;overflow:hidden}
@media(max-height:650px){.typing-lab .tl-stage-dialog{padding:10px 16px;gap:6px}.tl-stage-header{min-height:34px;padding-bottom:5px}.tl-stage-header h2{font-size:17px}.tl-stage-header p{display:none}.tl-stage-body{gap:4px;grid-template-rows:auto minmax(50px,1fr) auto auto}.tl-stage-dialog .tl-live-metrics>div{padding:4px 9px}.tl-stage-dialog .tl-live-metrics strong{font-size:16px}.tl-stage-dialog .tl-prompt{padding:7px 14px;font-size:min(var(--tl-prompt-size),26px)}.tl-stage-dialog .tl-keyboard-surface:not(.tl-numpad-mode){width:min(100%,calc((100dvh - 335px)*1.9231))}.tl-stage-dialog .tl-guide-options{padding:4px 8px;margin-top:2px}.tl-stage-dialog .tl-input-dock [data-tl-input-help]{display:none}.tl-stage-footer{padding-top:5px}.tl-stage-footer .btn{min-height:30px;padding:5px 10px}.tl-stage-footer .tl-status{max-height:30px}}
@media(max-width:650px){.typing-lab .tl-stage-dialog{width:calc(100vw - 12px);max-width:calc(100vw - 12px);height:calc(100dvh - 12px);max-height:calc(100dvh - 12px);padding:10px 12px;border-radius:12px}.tl-stage-header{gap:8px;align-items:flex-start}.tl-stage-header h2{font-size:17px}.tl-stage-header p{display:none}.tl-stage-tools{gap:4px}.tl-stage-tools label{font-size:0}.tl-stage-tools button{font-size:11px;padding:5px 8px}.tl-stage-body{gap:5px}.tl-stage-dialog .tl-live-metrics{gap:4px}.tl-stage-dialog .tl-live-metrics>div{gap:4px;padding:5px 4px}.tl-stage-dialog .tl-live-metrics span{font-size:9px}.tl-stage-dialog .tl-live-metrics strong{font-size:15px}.tl-stage-dialog .tl-prompt{font-size:min(var(--tl-prompt-size),28px);padding:9px 12px}.tl-stage-dialog .tl-input-dock{gap:4px}.tl-stage-dialog .tl-input-dock [data-tl-input-help]{display:none}.tl-stage-dialog .tl-input-preview{max-width:42%;font-size:11px}.tl-stage-dialog .tl-guide-options{gap:6px 10px;padding:5px}.tl-stage-dialog .tl-guide-options label{font-size:10px}.tl-stage-footer{align-items:flex-start;flex-direction:column;gap:4px}.tl-stage-footer .tl-practice-buttons{width:100%;gap:5px;justify-content:center}.tl-stage-footer .btn{padding:6px 9px;font-size:11px}.tl-stage-footer .tl-status,.tl-stage-footer .tl-error{max-height:30px;width:100%;text-align:center}}
@media(max-height:460px){.typing-lab .tl-stage-dialog[open]{overflow:auto;display:block}.tl-stage-dialog .tl-stage-body{min-height:315px;margin:8px 0}.tl-stage-dialog .tl-keyboard-surface:not(.tl-numpad-mode){width:min(100%,460px)}.tl-stage-dialog .tl-stage-footer{position:sticky;bottom:-10px;background:#f3f7ff;padding:7px}}
@media(prefers-reduced-motion:reduce){.tl-stage-dialog *{scroll-behavior:auto!important}}
