/* =========================================================
   Typing Master — design tokens
   ink        #0B0F1A   deep background
   surface    #141A2A   panels
   surface-2  #1C2338   raised panels / keys
   marigold   #FFA630   primary accent (energy, speed)
   teal       #22D3B9   success / correct
   coral      #FF5C72   error / incorrect
   mist       #8E96AC   muted text
   paper      #F4F1EA   light text on dark
   ========================================================= */

.tm-typing-app {
	/* Light theme is the TRUE default — these variables apply the moment
	   the widget appears on the page (even before JS finishes booting),
	   so visitors never see a flash of the dark theme. Dark mode is
	   opt-in only, via the .tm-theme-dark class below. */
	--tm-ink: #F4F1EA;
	--tm-surface: #FFFFFF;
	--tm-surface-2: #EFEBE2;
	--tm-surface-3: #E4DFD3;
	--tm-marigold: #E8790B;
	--tm-marigold-dim: #7A5A22;
	--tm-teal: #0EA893;
	--tm-coral: #E23A55;
	--tm-mist: #6B7280;
	--tm-paper: #1A1F2E;
	--tm-border: rgba(20,20,30,0.09);
	--tm-font-display: 'Sora', system-ui, sans-serif;
	--tm-font-body: 'Inter', system-ui, sans-serif;
	--tm-font-hi: 'Noto Sans Devanagari', 'Inter', system-ui, sans-serif;

	all: initial;
	*, *::before, *::after { box-sizing: border-box; }

	display: block;
	font-family: var(--tm-font-body);
	color: var(--tm-paper);
	background: radial-gradient(120% 140% at 15% -10%, #FFFDF9 0%, var(--tm-ink) 60%);
	border-radius: 24px;
	padding: clamp(16px, 3vw, 36px);
	max-width: 1600px;
	width: 100%;
	margin: 2rem auto;
	box-shadow: 0 30px 80px -30px rgba(20,20,30,0.15), 0 0 0 1px var(--tm-border);
	position: relative;
	overflow: hidden;
}

.tm-typing-app.tm-theme-dark {
	--tm-ink: #0B0F1A;
	--tm-surface: #141A2A;
	--tm-surface-2: #1C2338;
	--tm-surface-3: #242C46;
	--tm-marigold: #FFA630;
	--tm-marigold-dim: #7A5A22;
	--tm-teal: #22D3B9;
	--tm-coral: #FF5C72;
	--tm-mist: #8E96AC;
	--tm-paper: #F4F1EA;
	--tm-border: rgba(255,255,255,0.08);
	background: radial-gradient(120% 140% at 15% -10%, #1a2036 0%, var(--tm-ink) 55%);
	box-shadow: 0 30px 80px -30px rgba(0,0,0,0.6), 0 0 0 1px var(--tm-border);
}

.tm-typing-app .tm-loading {
	font-family: var(--tm-font-body);
	color: var(--tm-mist);
	text-align: center;
	padding: 40px;
}

/* decorative ambient glow */
.tm-typing-app::before {
	content: "";
	position: absolute;
	top: -120px;
	right: -120px;
	width: 320px;
	height: 320px;
	background: radial-gradient(circle, rgba(255,166,48,0.20) 0%, rgba(255,166,48,0) 70%);
	pointer-events: none;
	z-index: 0;
}

.tm-typing-app * { box-sizing: border-box; }
.tm-app-inner { position: relative; z-index: 1; }

/* ---------- Header row ---------- */
.tm-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 20px;
}

.tm-brand-eyebrow {
	font-family: var(--tm-font-display);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--tm-marigold);
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
}
.tm-brand-eyebrow .tm-dot {
	width: 7px; height: 7px; border-radius: 50%;
	background: var(--tm-teal);
	box-shadow: 0 0 0 0 rgba(34,211,185,0.6);
	animation: tm-pulse-dot 1.8s infinite;
}
@keyframes tm-pulse-dot {
	0% { box-shadow: 0 0 0 0 rgba(34,211,185,0.55); }
	70% { box-shadow: 0 0 0 8px rgba(34,211,185,0); }
	100% { box-shadow: 0 0 0 0 rgba(34,211,185,0); }
}

.tm-title {
	font-family: var(--tm-font-display);
	font-size: clamp(22px, 3vw, 30px);
	font-weight: 800;
	line-height: 1.15;
	margin: 0;
}
.tm-typing-app[data-lang="hi"] .tm-title,
.tm-title.tm-hi { font-family: var(--tm-font-hi); }

.tm-subtitle {
	color: var(--tm-mist);
	font-size: 13.5px;
	margin-top: 4px;
}

/* ---------- Rank badge (signature element, part 1) ---------- */
.tm-rank {
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--tm-surface);
	border: 1px solid var(--tm-border);
	border-radius: 999px;
	padding: 6px 16px 6px 6px;
}
.tm-rank-icon {
	width: 34px; height: 34px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	background: conic-gradient(from 180deg, var(--tm-marigold), var(--tm-teal), var(--tm-marigold));
	font-size: 16px;
	flex-shrink: 0;
	animation: tm-spin 6s linear infinite;
}
.tm-rank-icon span { display:block; animation: tm-spin-counter 6s linear infinite; }
@keyframes tm-spin { to { transform: rotate(360deg); } }
@keyframes tm-spin-counter { to { transform: rotate(-360deg); } }

.tm-rank-text { display: flex; flex-direction: column; line-height: 1.2; }
.tm-rank-label { font-size: 10px; color: var(--tm-mist); text-transform: uppercase; letter-spacing: 0.08em; }
.tm-rank-name { font-family: var(--tm-font-display); font-weight: 700; font-size: 14px; }

/* ---------- Controls: language / mode / difficulty pills ----------
   Row 1 is the mode tabs (Paragraph / Word Practice / Key Practice /
   Numeric) on their own. Row 2 keeps language on the left and the
   matching difficulty pills (word level or key drill level) on the
   right, both in that one shared row instead of wrapping together
   into a jumbled mess. */
.tm-controls {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 20px;
}
.tm-mode-group {
	flex-wrap: wrap;
}
.tm-controls-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px;
}
.tm-controls-row-right {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-left: auto;
}
.tm-pill-group {
	display: inline-flex;
	background: var(--tm-surface);
	border: 1px solid var(--tm-border);
	border-radius: 999px;
	padding: 4px;
	gap: 2px;
}
.tm-pill {
	font-family: var(--tm-font-body);
	font-weight: 600;
	font-size: 12.5px;
	color: var(--tm-mist);
	background: transparent;
	border: none;
	border-radius: 999px;
	padding: 7px 14px;
	cursor: pointer;
	transition: all .2s ease;
	white-space: nowrap;
}
.tm-pill:hover { color: var(--tm-paper); }
.tm-pill.is-active {
	background: var(--tm-marigold);
	color: #201200;
	box-shadow: 0 4px 14px -4px rgba(255,166,48,0.6);
}
.tm-pill[data-lang-pill="hi"] { font-family: var(--tm-font-hi); }

.tm-difficulty-row { display: none; }
.tm-difficulty-row.is-visible { display: inline-flex; }
.tm-session-row.is-visible { display: flex; margin-top: 8px; width: 100%; flex-wrap: wrap; }

/* ---------- Stat strip ---------- */
.tm-stats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
	margin-bottom: 18px;
}
@media (max-width: 640px) { .tm-stats { grid-template-columns: repeat(2, 1fr); } }

.tm-stat {
	background: var(--tm-surface);
	border: 1px solid var(--tm-border);
	border-radius: 16px;
	padding: 12px 14px;
	position: relative;
	overflow: hidden;
}
.tm-stat-label {
	font-size: 10.5px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--tm-mist);
	margin-bottom: 4px;
}
.tm-stat-value {
	font-family: var(--tm-font-display);
	font-size: 22px;
	font-weight: 700;
}
.tm-stat.tm-stat-wpm .tm-stat-value { color: var(--tm-marigold); }
.tm-stat.tm-stat-acc .tm-stat-value { color: var(--tm-teal); }

/* ---------- Analog speedometer gauges for live WPM / Accuracy ---------- */
.tm-gauge-stat { padding: 10px 12px 8px; }
.tm-gauge-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
}
.tm-gauge-svg { width: 100%; max-width: 108px; height: auto; overflow: visible; }
.tm-gauge-track {
	fill: none;
	stroke-width: 8;
	stroke-linecap: round;
	opacity: .9;
}
.tm-gauge-needle {
	stroke: var(--tm-paper);
	stroke-width: 3;
	stroke-linecap: round;
	transform-box: fill-box;
	transform-origin: 50% 100%;
	transition: transform .35s cubic-bezier(.22,1,.36,1);
	filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
}
.tm-gauge-hub { fill: var(--tm-paper); stroke: var(--tm-ink, #14181f); stroke-width: 1.5; }
.tm-gauge-readout {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin-top: -6px;
}
.tm-gauge-readout .tm-stat-value { font-size: 20px; line-height: 1.1; }
.tm-gauge-readout .tm-stat-label { margin-bottom: 0; }

/* Speed Aura — signature element, part 2: glowing ring pulses with WPM */
.tm-stat-wpm { position: relative; }
.tm-aura {
	position: absolute;
	inset: -1px;
	border-radius: 16px;
	pointer-events: none;
	opacity: 0;
	transition: opacity .4s ease;
	box-shadow: 0 0 0 0 rgba(255,166,48,0.0);
}
.tm-aura.is-active {
	opacity: 1;
	animation: tm-aura-pulse 1.4s ease-in-out infinite;
}
@keyframes tm-aura-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(255,166,48,0.35), inset 0 0 20px -6px rgba(255,166,48,0.25); }
	50% { box-shadow: 0 0 0 6px rgba(255,166,48,0), inset 0 0 26px -4px rgba(255,166,48,0.45); }
}

/* ---------- Typing stage ---------- */
.tm-stage {
	background: var(--tm-surface);
	border: 1px solid var(--tm-border);
	border-radius: 20px;
	padding: 22px 24px;
	margin-bottom: 22px;
	position: relative;
}

.tm-progress-track {
	height: 4px;
	background: var(--tm-surface-3);
	border-radius: 999px;
	overflow: hidden;
	margin-bottom: 10px;
}
.tm-progress-fill {
	height: 100%;
	width: 0%;
	background: linear-gradient(90deg, var(--tm-teal), var(--tm-marigold));
	border-radius: 999px;
	transition: width .18s ease;
}

/* ---------- Text-size (A- / A+) controls ---------- */
.tm-stage-toprow {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 8px;
}
.tm-fontsize-group {
	display: flex;
	align-items: center;
	gap: 6px;
	background: var(--tm-surface-2);
	border: 1px solid var(--tm-border);
	border-radius: 999px;
	padding: 4px 6px 4px 12px;
}
.tm-fontsize-label { font-size: 11px; color: var(--tm-mist); font-weight: 600; margin-right: 2px; white-space: nowrap; }
.tm-fontsize-btn {
	width: 28px; height: 28px;
	display: flex; align-items: center; justify-content: center;
	background: var(--tm-surface);
	border: 1px solid var(--tm-border);
	border-radius: 50%;
	font-family: var(--tm-font-display);
	font-weight: 700;
	font-size: 12px;
	color: var(--tm-paper);
	cursor: pointer;
	transition: transform .1s ease, background .15s ease;
}
.tm-fontsize-btn:hover:not(:disabled) { transform: translateY(-1px); background: var(--tm-surface-3); }
.tm-fontsize-btn:disabled { opacity: .35; cursor: not-allowed; }
.tm-fontsize-readout { font-size: 11.5px; font-weight: 700; color: var(--tm-mist); min-width: 34px; text-align: center; }

.tm-text-display {
	font-family: var(--tm-font-body);
	/* Base size is still responsive, but multiplied by a user-adjustable
	   scale (set via the A- / A+ controls, see .tm-fontsize-group) so
	   people can size the practice text to their own comfort. */
	font-size: calc(clamp(22px, 3.2vw, 32px) * var(--tm-text-scale, 1));
	line-height: 2.05;
	letter-spacing: 0.2px;
	color: var(--tm-mist);
	user-select: none;
	/* Wrap onto as many lines as the text needs, but cap the visible
	   height at ~3 lines and scroll the rest - the box auto-scrolls to
	   follow the caret as you type (see scrollTextToCurrent in JS), so
	   the current line never runs out of view and text never spills
	   past the right/bottom edge of the box. */
	white-space: normal;
	word-break: normal;
	overflow-wrap: break-word;
	max-height: 3.35em;
	overflow-y: auto;
	scroll-behavior: smooth;
	padding-right: 6px;
	scrollbar-width: thin;
	scrollbar-color: var(--tm-marigold-dim) transparent;
}
.tm-text-display::-webkit-scrollbar { width: 7px; }
.tm-text-display::-webkit-scrollbar-track { background: transparent; }
.tm-text-display::-webkit-scrollbar-thumb { background: var(--tm-border); border-radius: 999px; }
.tm-text-display::-webkit-scrollbar-thumb:hover { background: var(--tm-marigold); }
.tm-typing-app[data-lang="hi"] .tm-text-display,
.tm-text-display.tm-hi { font-family: var(--tm-font-hi); line-height: 2.35; max-height: 3.85em; }

.tm-text-display .tm-char { position: relative; border-radius: 3px; }
.tm-text-display .tm-char.tm-correct { color: var(--tm-teal); }
.tm-text-display .tm-char.tm-incorrect { color: var(--tm-coral); background: rgba(255,92,114,0.14); animation: tm-shake .18s ease; }
.tm-text-display .tm-char.tm-current { color: var(--tm-paper); }
.tm-text-display .tm-char.tm-current::after {
	content: "";
	position: absolute;
	left: 0; right: 0; bottom: -2px;
	height: 2px;
	background: var(--tm-marigold);
	animation: tm-caret-blink 1s step-end infinite;
	border-radius: 2px;
}
@keyframes tm-caret-blink { 50% { opacity: 0.15; } }
@keyframes tm-shake {
	0%, 100% { transform: translateX(0); }
	25% { transform: translateX(-2px); }
	75% { transform: translateX(2px); }
}

.tm-hidden-input {
	position: absolute;
	opacity: 0;
	width: 1px; height: 1px;
	border: 0;
	padding: 0;
	font-size: 16px; /* avoids iOS auto-zoom-on-focus, which can make the keyboard flow feel "stuck"/broken */
}

.tm-stage-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 16px;
	flex-wrap: wrap;
	gap: 10px;
}
.tm-hint { font-size: 12.5px; color: var(--tm-mist); }
.tm-hint strong { color: var(--tm-paper); }

.tm-btn {
	font-family: var(--tm-font-display);
	font-weight: 700;
	font-size: 13px;
	border: none;
	border-radius: 12px;
	padding: 10px 18px;
	cursor: pointer;
	background: var(--tm-surface-3);
	color: var(--tm-paper);
	transition: transform .15s ease, background .2s ease;
}
.tm-btn:hover { transform: translateY(-1px); }
.tm-btn.tm-btn-primary {
	background: linear-gradient(135deg, var(--tm-marigold), #ff8a3d);
	color: #211200;
	box-shadow: 0 10px 24px -10px rgba(255,166,48,0.7);
}
.tm-btn.tm-btn-primary:hover { box-shadow: 0 14px 28px -10px rgba(255,166,48,0.85); }

/* ---------- Virtual keyboard ---------- */
.tm-keyboard-wrap {
	background: var(--tm-surface);
	border: 1px solid var(--tm-border);
	border-radius: 20px;
	padding: 18px 16px 20px;
}
.tm-keyboard-label {
	font-size: 10.5px;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--tm-mist);
	margin-bottom: 10px;
	display: flex;
	align-items: center;
	gap: 8px;
}
.tm-keyboard-label .tm-legend { display: inline-flex; gap: 12px; margin-left: auto; font-size: 10px; text-transform: none; letter-spacing: 0; }
.tm-legend-item { display: inline-flex; align-items: center; gap: 4px; }
.tm-legend-dot { width: 8px; height: 8px; border-radius: 3px; }

.tm-keyboard {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.tm-key-row { display: flex; gap: 8px; }
.tm-key {
	flex: 1;
	min-width: 0;
	height: 60px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--tm-surface-2);
	border: 1px solid var(--tm-border);
	border-bottom: 3px solid var(--tm-border);
	border-radius: 10px;
	font-family: var(--tm-font-body);
	font-size: 18px;
	font-weight: 700;
	color: var(--tm-paper);
	transition: transform .08s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}
.tm-typing-app[data-lang="hi"] .tm-key { font-family: var(--tm-font-hi); }
.tm-key.tm-key-wide { flex: 2.4; }
.tm-key.tm-key-space { flex: 8; }
.tm-key.tm-key-ghost { background: transparent; border-color: transparent; color: var(--tm-mist); opacity: .5; font-size: 13px; }

.tm-key.tm-key-target {
	background: var(--tm-marigold);
	border-bottom-color: var(--tm-marigold-dim);
	color: #201200;
	box-shadow: 0 0 0 3px rgba(255,166,48,0.25), 0 6px 16px -4px rgba(255,166,48,0.7);
	transform: translateY(-2px);
}
.tm-key.tm-key-pressed-correct { background: var(--tm-teal); color: #04231d; transform: scale(0.94) translateY(1px); }
.tm-key.tm-key-pressed-wrong { background: var(--tm-coral); color: #2a0006; transform: scale(0.94) translateY(1px); }

/* ---------- Word-mode chip list ---------- */
.tm-word-list { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.tm-word-chip {
	padding: 6px 10px;
	border-radius: 8px;
	background: transparent;
}
.tm-word-chip.tm-current { background: var(--tm-surface-3); box-shadow: 0 0 0 1px var(--tm-marigold) inset; }

/* ---------- Result / completion overlay ---------- */
.tm-result {
	display: none;
	text-align: center;
	padding: 26px 10px 10px;
}
.tm-result.is-visible { display: block; }
.tm-result-title {
	font-family: var(--tm-font-display);
	font-size: 22px;
	font-weight: 800;
	margin-bottom: 4px;
	background: linear-gradient(90deg, var(--tm-marigold), var(--tm-teal));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}
.tm-result-sub { color: var(--tm-mist); font-size: 13px; margin-bottom: 18px; }
.tm-result-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
	max-width: 420px;
	margin: 0 auto 20px;
}
.tm-result-grid .tm-stat { padding: 14px 10px; }

/* confetti burst */
.tm-confetti-piece {
	position: absolute;
	top: 40%;
	left: 50%;
	width: 7px; height: 12px;
	border-radius: 2px;
	opacity: 0;
	z-index: 5;
	pointer-events: none;
}
@keyframes tm-confetti-fall {
	0% { opacity: 1; transform: translate(0,0) rotate(0deg); }
	100% { opacity: 0; transform: var(--tm-confetti-end) rotate(540deg); }
}
.tm-confetti-piece.tm-fire { animation: tm-confetti-fall 1.1s ease-out forwards; }

/* ---------- misc ---------- */
.tm-footer-note {
	text-align: center;
	color: var(--tm-mist);
	font-size: 11px;
	margin-top: 16px;
	opacity: .7;
}

@media (prefers-reduced-motion: reduce) {
	.tm-typing-app * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

@media (max-width: 560px) {
	.tm-key { height: 48px; font-size: 14.5px; }
	.tm-key-row { gap: 5px; }
	.tm-keyboard { gap: 5px; }
	.tm-result-grid { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
	.tm-rank { padding: 4px 12px 4px 4px; }
	.tm-controls-row { flex-direction: column; align-items: stretch; }
	.tm-controls-row-right { margin-left: 0; }
	.tm-theme-toggle { width: 140px; height: 36px; }
	.tm-theme-toggle-opt { font-size: 11px; }
	.tm-stage-toprow { justify-content: center; }
}

/* =========================================================
   eTyping additions: theme toggle, font switcher, numeric
   keypad, level tags and the finger/hand guidance panel.
   ========================================================= */

/* ---------- Header: theme toggle ----------
   A clear two-label segmented switch (☀️ Light | 🌙 Dark) with a sliding
   knob that sits over whichever side is active, instead of a single
   ambiguous icon button — the current mode is always spelled out. */
.tm-header-right { display: flex; align-items: center; gap: 10px; }
.tm-theme-toggle {
	position: relative;
	display: flex;
	align-items: center;
	width: 168px;
	height: 40px;
	padding: 3px;
	background: var(--tm-surface-2);
	border: 1px solid var(--tm-border);
	border-radius: 999px;
	cursor: pointer;
	font-family: var(--tm-font-display);
}
.tm-theme-toggle-opt {
	position: relative;
	z-index: 2;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	height: 100%;
	font-size: 12px;
	font-weight: 700;
	color: var(--tm-mist);
	transition: color .2s ease;
	pointer-events: none;
}
.tm-theme-toggle-knob {
	position: absolute;
	top: 3px; left: 3px;
	width: calc(50% - 3px);
	height: calc(100% - 6px);
	background: var(--tm-surface);
	border-radius: 999px;
	box-shadow: 0 4px 10px -4px rgba(20,20,30,0.35), 0 0 0 1px var(--tm-border);
	transition: transform .22s cubic-bezier(.4,0,.2,1);
	z-index: 1;
}
.tm-theme-toggle .tm-theme-toggle-light { color: var(--tm-paper); }
.tm-theme-toggle.is-dark .tm-theme-toggle-knob { transform: translateX(100%); }
.tm-theme-toggle.is-dark .tm-theme-toggle-light { color: var(--tm-mist); }
.tm-theme-toggle.is-dark .tm-theme-toggle-dark { color: var(--tm-paper); }
.tm-theme-toggle:hover .tm-theme-toggle-knob { box-shadow: 0 6px 14px -4px rgba(20,20,30,0.45), 0 0 0 1px var(--tm-border); }

/* ---------- Difficulty / level tag on key-drill pills ---------- */
.tm-level-tag {
	font-size: 9.5px;
	opacity: .75;
	margin-left: 4px;
	text-transform: uppercase;
	letter-spacing: .04em;
}

/* ---------- Hindi font selector ---------- */
.tm-font-row { align-items: center; gap: 8px; padding: 4px 10px; }
.tm-font-label { font-size: 12px; color: var(--tm-mist); font-weight: 600; white-space: nowrap; }
.tm-font-select {
	background: var(--tm-surface-2);
	color: var(--tm-paper);
	border: 1px solid var(--tm-border);
	border-radius: 999px;
	padding: 6px 12px;
	font-size: 12.5px;
	font-family: var(--tm-font-body);
	cursor: pointer;
}
.tm-krutidev-note {
	display: none;
	font-size: 11.5px;
	line-height: 1.5;
	color: var(--tm-mist);
	background: var(--tm-surface);
	border: 1px dashed var(--tm-border);
	border-radius: 12px;
	padding: 10px 14px;
	margin: -10px 0 20px;
}

/* Unicode Devanagari (default) */
.tm-typing-app.tm-font-tiro .tm-text-display,
.tm-typing-app.tm-font-tiro .tm-key { font-family: 'Tiro Devanagari Hindi', var(--tm-font-hi); }

/* Kruti Dev 010 - bundled with the plugin as a real webfont, so it
   renders correctly for every visitor without needing it installed
   on their device. The lesson text itself is converted into real
   Kruti Dev byte-encoding in JS (see unicodeToKrutiDev) before it's
   shown here, which is what makes this font draw as Hindi at all. */
@font-face {
	font-family: 'Kruti Dev 010';
	src: url('../fonts/KrutiDev010.ttf') format('truetype');
	font-weight: normal;
	font-style: normal;
	font-display: swap;
}
.tm-typing-app.tm-font-krutidev .tm-text-display,
.tm-typing-app.tm-font-krutidev .tm-key { font-family: 'Kruti Dev 010', 'KrutiDev010', var(--tm-font-hi); }

/* ---------- Word/word-practice level pills already reuse .tm-pill ---------- */

/* ---------- Numeric keypad layout ---------- */
.tm-numpad-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	grid-auto-rows: 52px;
	gap: 8px;
	max-width: 360px;
	margin: 0 auto;
}
.tm-numpad-grid .tm-key { height: auto; }
.tm-numpad-grid .tm-key-wide2 { grid-column: span 2; }
.tm-numpad-grid .tm-key-tall { grid-row: span 2; }

/* ---------- Finger colour tokens ---------- */
.tm-typing-app {
	--tm-f-pinky-l: #FF5C72;
	--tm-f-ring-l: #FF9F5C;
	--tm-f-middle-l: #FFD93D;
	--tm-f-index-l: #8BD450;
	--tm-f-thumb: #8E96AC;
	--tm-f-index-r: #4DD0E1;
	--tm-f-middle-r: #5C9CFF;
	--tm-f-ring-r: #B183FF;
	--tm-f-pinky-r: #FF7AC6;
}

/* subtle finger-colour indicator dot at the bottom edge of each key */
.tm-key[data-finger] { position: relative; }
.tm-key[data-finger]::before {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 3px;
	transform: translateX(-50%);
	width: 12px; height: 3px;
	border-radius: 2px;
	opacity: .55;
}
.tm-key.tm-f-pinky-l::before,  .tm-finger-dot.tm-f-pinky-l  { background: var(--tm-f-pinky-l); }
.tm-key.tm-f-ring-l::before,   .tm-finger-dot.tm-f-ring-l   { background: var(--tm-f-ring-l); }
.tm-key.tm-f-middle-l::before, .tm-finger-dot.tm-f-middle-l { background: var(--tm-f-middle-l); }
.tm-key.tm-f-index-l::before,  .tm-finger-dot.tm-f-index-l  { background: var(--tm-f-index-l); }
.tm-key.tm-f-thumb::before,    .tm-finger-dot.tm-f-thumb    { background: var(--tm-f-thumb); }
.tm-key.tm-f-index-r::before,  .tm-finger-dot.tm-f-index-r  { background: var(--tm-f-index-r); }
.tm-key.tm-f-middle-r::before, .tm-finger-dot.tm-f-middle-r { background: var(--tm-f-middle-r); }
.tm-key.tm-f-ring-r::before,   .tm-finger-dot.tm-f-ring-r   { background: var(--tm-f-ring-r); }
.tm-key.tm-f-pinky-r::before,  .tm-finger-dot.tm-f-pinky-r  { background: var(--tm-f-pinky-r); }
.tm-key.tm-key-target::before,
.tm-key.tm-key-pressed-correct::before,
.tm-key.tm-key-pressed-wrong::before { opacity: 0; }

/* ---------- Keyboard stage (keys + transparent hand overlay) ---------- */
.tm-keyboard-stage { position: relative; }
.tm-hand-overlay {
	position: absolute;
	inset: 0;
	pointer-events: none;
	opacity: 1;
	transition: opacity .25s ease;
	z-index: 4;
}
.tm-hand-overlay.is-hidden,
.tm-hand-overlay.is-numeric { opacity: 0; }
.tm-hand-svg { display: block; overflow: visible; }

/* The stylised hand shapes sit at a low, "ghosted" opacity by default so
   the keys underneath stay fully legible, and glow up when that hand's
   finger is the one the person should use next. */
.tm-hg-hand { transition: opacity .18s ease; }
.tm-hg-palm {
	fill: var(--tm-mist);
	fill-opacity: .16;
	stroke: var(--tm-mist);
	stroke-opacity: .35;
	stroke-width: 2.5;
}
.tm-hg-hand.is-active .tm-hg-palm {
	fill: var(--tm-marigold);
	fill-opacity: .22;
	stroke: var(--tm-marigold);
	stroke-opacity: .8;
}
.tm-hg-line {
	stroke: var(--tm-mist);
	stroke-opacity: .3;
	stroke-width: 1.5;
	stroke-dasharray: 3 3;
	transition: stroke-opacity .15s ease, stroke-width .15s ease;
}
.tm-hg-line.is-active {
	stroke: var(--tm-marigold);
	stroke-opacity: .9;
	stroke-width: 2.25;
	stroke-dasharray: none;
}
.tm-hg-dot {
	fill-opacity: .55;
	stroke: var(--tm-surface);
	stroke-width: 1.5;
	transition: r .15s ease, fill-opacity .15s ease;
}
.tm-hg-dot.tm-f-pinky-l  { fill: var(--tm-f-pinky-l); }
.tm-hg-dot.tm-f-ring-l   { fill: var(--tm-f-ring-l); }
.tm-hg-dot.tm-f-middle-l { fill: var(--tm-f-middle-l); }
.tm-hg-dot.tm-f-index-l  { fill: var(--tm-f-index-l); }
.tm-hg-dot.tm-f-index-r  { fill: var(--tm-f-index-r); }
.tm-hg-dot.tm-f-middle-r { fill: var(--tm-f-middle-r); }
.tm-hg-dot.tm-f-ring-r   { fill: var(--tm-f-ring-r); }
.tm-hg-dot.tm-f-pinky-r  { fill: var(--tm-f-pinky-r); }
.tm-hg-dot.is-active { r: 8; fill-opacity: 1; }

.tm-hand-toggle {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin-left: 10px;
	background: var(--tm-surface-2);
	border: 1px solid var(--tm-border);
	border-radius: 999px;
	padding: 5px 12px;
	font-size: 11.5px;
	font-weight: 700;
	color: var(--tm-paper);
	cursor: pointer;
	transition: background .15s ease, opacity .15s ease;
}
.tm-hand-toggle:hover { background: var(--tm-surface-3); }
.tm-hand-toggle.is-off { opacity: .55; }

/* ---------- Finger legend strip (colour key only) ---------- */
.tm-finger-guide {
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px solid var(--tm-border);
	display: flex;
	align-items: center;
}
.tm-finger-legend { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.tm-finger-chip { display: inline-flex; align-items: center; opacity: .55; transition: opacity .15s ease, transform .15s ease; }
.tm-finger-chip.is-active { opacity: 1; transform: scale(1.15); }
.tm-finger-dot { width: 10px; height: 10px; border-radius: 50%; display: block; }

@media (max-width: 640px) {
	.tm-keyboard-label { flex-wrap: wrap; }
	.tm-hand-toggle { margin-left: 0; }
	.tm-finger-hands { justify-content: center; }
}

/* ---------- Setup screen (Name / Set Time / Language) ---------- */
.tm-user-greeting {
	margin-top: 6px;
	font-size: 12.5px;
	color: var(--tm-mist);
}
.tm-user-greeting strong { color: var(--tm-marigold); }

.tm-setup-edit-btn { font-size: 12px; padding: 8px 14px; }

.tm-setup-screen {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 420px;
	padding: 20px 0;
}
.tm-setup-card {
	width: 100%;
	max-width: 480px;
	background: var(--tm-surface);
	border: 1px solid var(--tm-border);
	border-radius: 20px;
	padding: clamp(20px, 4vw, 32px);
	box-shadow: 0 20px 50px -20px rgba(0,0,0,0.5);
}
.tm-setup-title {
	font-family: var(--tm-font-display);
	font-size: clamp(20px, 3vw, 24px);
	font-weight: 800;
	margin: 10px 0 22px;
	line-height: 1.35;
}
.tm-setup-title-hi {
	display: block;
	font-family: var(--tm-font-hi);
	font-size: 14px;
	font-weight: 600;
	color: var(--tm-mist);
	margin-top: 4px;
}
.tm-setup-field { margin-bottom: 18px; }
.tm-setup-label {
	display: block;
	font-family: var(--tm-font-display);
	font-weight: 700;
	font-size: 13px;
	margin-bottom: 8px;
}
.tm-setup-label-hi {
	font-family: var(--tm-font-hi);
	font-weight: 500;
	font-size: 12px;
	color: var(--tm-mist);
	margin-left: 4px;
}
.tm-setup-input {
	width: 100%;
	font-family: var(--tm-font-body);
	font-size: 14px;
	color: var(--tm-paper);
	background: var(--tm-surface-2);
	border: 1px solid var(--tm-border);
	border-radius: 12px;
	padding: 12px 14px;
	outline: none;
	transition: border-color .15s ease;
}
.tm-setup-input:focus { border-color: var(--tm-marigold); }
.tm-setup-pill-group {
	flex-wrap: wrap;
	width: 100%;
}
.tm-setup-pill-group .tm-pill { padding: 9px 14px; }
.tm-setup-pill-hi {
	font-family: var(--tm-font-hi);
	font-size: 11px;
	opacity: .75;
	margin-left: 3px;
}
.tm-setup-font-row .tm-font-select { width: 100%; }
.tm-setup-start-btn {
	width: 100%;
	margin-top: 6px;
	padding: 14px 18px;
	font-size: 14.5px;
	text-align: center;
}

@media (max-width: 480px) {
	.tm-setup-pill-group { gap: 6px; }
}
