/*
 * Test Your Level: student app.
 * Palette: indigo → violet gradient, deep navy ink, lavender wash, coral for
 * recording, green for success. Everything is scoped to .tyl-app (and the
 * course-page button and dialog) so it sits safely inside any theme.
 */
.tyl-app,
.tyl-dialog,
.tyl-cta {
	--tyl-ink: #0d1033;
	--tyl-text: #2b2f4c;
	--tyl-muted: #676d8a;
	--tyl-faint: #9aa0b8;
	--tyl-line: #e6e8f4;
	--tyl-line-strong: #d5d9ee;
	--tyl-soft: #f4f5fc;
	--tyl-surface: #ffffff;
	--tyl-blue: #3b5bfd;
	--tyl-indigo: #5a5cf6;
	--tyl-violet: #a65cf2;
	--tyl-grad: linear-gradient(100deg, #3b5bfd 0%, #6a5cf8 52%, #b05ef0 100%);
	--tyl-grad-soft: linear-gradient(135deg, #eef0ff 0%, #f5f1ff 55%, #fbefff 100%);
	--tyl-tint: #eef0ff;
	--tyl-coral: #f6704f;
	--tyl-coral-soft: #ffe7df;
	--tyl-green: #12a87a;
	--tyl-green-soft: #ddf6ec;
	--tyl-amber: #c98a0c;
	--tyl-amber-soft: #fdf1d6;
	--tyl-red: #e0483e;
	--tyl-radius: 24px;
	--tyl-radius-md: 16px;
	--tyl-radius-sm: 12px;
	--tyl-shadow: 0 1px 2px rgba(13, 16, 51, 0.04), 0 12px 32px -12px rgba(13, 16, 51, 0.12);
	--tyl-shadow-lg: 0 2px 6px rgba(13, 16, 51, 0.04), 0 30px 70px -28px rgba(59, 91, 253, 0.35);
	--tyl-glow: 0 10px 28px -10px rgba(90, 92, 246, 0.6);
	--tyl-font: "Lexend", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.tyl-app {
	container: tyl / inline-size;
	max-width: 1040px;
	margin: 1.5em 0;
	font-family: var(--tyl-font);
	font-size: 16px;
	line-height: 1.6;
	color: var(--tyl-text);
	-webkit-font-smoothing: antialiased;
	box-sizing: border-box;
}
.tyl-app *, .tyl-app *::before, .tyl-app *::after { box-sizing: inherit; }
.tyl-app p { margin: 0; }
.tyl-app h2, .tyl-app h3, .tyl-app h4 { font-family: var(--tyl-font); color: var(--tyl-ink); text-transform: none; letter-spacing: -0.02em; }
.tyl-shell { display: flex; flex-direction: column; gap: 20px; }

/* ---------------------------------------------------------------- Icons, tiles, pills */

.tyl-ico { display: inline-flex; width: 1.15em; height: 1.15em; flex: none; }
.tyl-ico svg { width: 100%; height: 100%; display: block; }

.tyl-tile {
	display: inline-flex; align-items: center; justify-content: center; flex: none;
	width: 34px; height: 34px; border-radius: 11px; font-size: 17px;
	color: var(--tyl-blue); background: var(--tyl-tint);
}
.tyl-tile-reading { color: #4f4ff0; background: #ecebff; }
.tyl-tile-writing { color: #8b4fe6; background: #f3eaff; }
.tyl-tile-speaking { color: var(--tyl-coral); background: var(--tyl-coral-soft); }
.tyl-tile-big { width: 56px; height: 56px; border-radius: 18px; font-size: 26px; color: #fff; background: var(--tyl-grad); box-shadow: var(--tyl-glow); }
.tyl-tile-big.tyl-tile-speaking { background: linear-gradient(135deg, #ff8a5c, #f4594a); box-shadow: 0 10px 28px -10px rgba(246, 112, 79, 0.7); }

.tyl-pill {
	display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
	padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; line-height: 1.3;
	background: var(--tyl-soft); color: var(--tyl-muted);
}
.tyl-pill .tyl-ico { width: 14px; height: 14px; }
.tyl-pill-blue { background: var(--tyl-tint); color: var(--tyl-blue); }
.tyl-pill-violet { background: #f3eaff; color: #7d45d8; }
.tyl-pill-green { background: var(--tyl-green-soft); color: #0b7f5b; }
.tyl-pill-amber { background: var(--tyl-amber-soft); color: #92650a; }
.tyl-pill-coral { background: var(--tyl-coral-soft); color: #c8462a; }
.tyl-pill-muted { background: var(--tyl-soft); color: var(--tyl-muted); }

.tyl-kicker { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--tyl-faint); }
.tyl-muted { color: var(--tyl-muted); font-size: 0.93em; }
.tyl-small { font-size: 0.85em; }
.tyl-grad-text { background: var(--tyl-grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 600; }

.tyl-alert {
	display: flex; align-items: flex-start; gap: 10px; margin: 0;
	padding: 12px 16px; border-radius: var(--tyl-radius-sm);
	background: #fdeceb; color: #a8322a; font-weight: 500; font-size: 0.95em;
}
.tyl-alert .tyl-ico { margin-top: 2px; }
.tyl-alert-soft { background: var(--tyl-soft); color: var(--tyl-muted); font-weight: 400; }
.tyl-error { color: var(--tyl-red); font-weight: 600; }
.tyl-ok { color: var(--tyl-green); font-weight: 600; }

/* ---------------------------------------------------------------- Buttons */

.tyl-app .tyl-btn,
.tyl-open-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 10px;
	min-height: 48px; padding: 12px 22px; margin: 0;
	border: 1px solid var(--tyl-line-strong); border-radius: 999px;
	background: var(--tyl-surface); color: var(--tyl-ink); box-shadow: none;
	font-family: var(--tyl-font); font-size: 15px; font-weight: 600; line-height: 1.2;
	letter-spacing: 0; text-transform: none; text-decoration: none; white-space: nowrap;
	cursor: pointer; transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.tyl-app .tyl-btn:hover { border-color: var(--tyl-indigo); color: var(--tyl-ink); background: var(--tyl-surface); }
.tyl-app .tyl-btn:active { transform: translateY(1px); }
.tyl-app .tyl-btn .tyl-ico { width: 18px; height: 18px; }
.tyl-app .tyl-btn-primary,
.tyl-open-btn {
	border: 0; color: #fff; background: var(--tyl-grad); background-size: 140% 100%; background-position: 0 0;
	box-shadow: var(--tyl-glow);
}
.tyl-app .tyl-btn-primary:hover,
.tyl-open-btn:hover {
	color: #fff; background: var(--tyl-grad); background-size: 140% 100%; background-position: 100% 0;
	box-shadow: 0 14px 34px -10px rgba(90, 92, 246, 0.75); transform: translateY(-1px);
}
.tyl-app .tyl-btn-lg { min-height: 54px; padding: 14px 28px; font-size: 16px; }
.tyl-app .tyl-btn-sm { min-height: 40px; padding: 8px 16px; font-size: 14px; }
.tyl-app .tyl-btn-ghost { background: transparent; border-color: transparent; color: var(--tyl-muted); }
.tyl-app .tyl-btn-ghost:hover { background: var(--tyl-soft); border-color: transparent; color: var(--tyl-ink); }
.tyl-app .tyl-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.tyl-app :focus-visible,
.tyl-open-btn:focus-visible,
.tyl-dialog :focus-visible { outline: 3px solid rgba(90, 92, 246, 0.45); outline-offset: 3px; }

/* ---------------------------------------------------------------- Cards */

.tyl-card {
	position: relative; padding: 32px; border-radius: var(--tyl-radius);
	background: var(--tyl-surface); color: var(--tyl-text);
	border: 1px solid var(--tyl-line); box-shadow: var(--tyl-shadow);
}
.tyl-card-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.tyl-app .tyl-h { margin: 4px 0 0; font-size: 26px; font-weight: 700; line-height: 1.2; }
.tyl-app .tyl-h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 17px; font-weight: 600; }
.tyl-lead { color: var(--tyl-muted); font-size: 1.02em; }
.tyl-center { text-align: center; padding: 64px 28px; }
.tyl-center .tyl-muted { max-width: 420px; margin: 8px auto 0; }

/* ---------------------------------------------------------------- Home hero */

.tyl-hero {
	position: relative; overflow: hidden; padding: 40px;
	border-radius: var(--tyl-radius); border: 1px solid #e3e5fb;
	background:
		radial-gradient(600px 320px at 0% 0%, rgba(59, 91, 253, 0.13), transparent 70%),
		radial-gradient(520px 360px at 100% 10%, rgba(176, 94, 240, 0.16), transparent 70%),
		linear-gradient(180deg, #f8f8ff, #fbf9ff);
	box-shadow: var(--tyl-shadow);
}
.tyl-hero::after {
	content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
	background-image: linear-gradient(rgba(90, 92, 246, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(90, 92, 246, 0.06) 1px, transparent 1px);
	background-size: 44px 44px;
	-webkit-mask-image: linear-gradient(180deg, #000, transparent 75%); mask-image: linear-gradient(180deg, #000, transparent 75%);
}
.tyl-hero > * { position: relative; z-index: 1; }
.tyl-eyebrow {
	display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
	background: #fff; border: 1px solid #e3e5fb; box-shadow: 0 4px 14px -6px rgba(59, 91, 253, 0.3);
	color: var(--tyl-blue); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
}
.tyl-app .tyl-title { margin: 18px 0 10px; font-size: clamp(30px, 5.2vw, 46px); font-weight: 800; line-height: 1.08; letter-spacing: -0.035em; color: var(--tyl-ink); }
.tyl-hero .tyl-lead { max-width: 640px; font-size: 1.08em; line-height: 1.65; color: #4a4f6c; }
.tyl-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 28px; }
.tyl-chip {
	display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px; border-radius: 999px;
	background: rgba(255, 255, 255, 0.85); border: 1px solid var(--tyl-line); font-weight: 600; font-size: 14px; color: var(--tyl-ink);
}
.tyl-chip .tyl-tile { width: 30px; height: 30px; border-radius: 999px; font-size: 15px; }

.tyl-phases { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tyl-phase {
	display: flex; flex-direction: column; gap: 14px; padding: 22px; min-height: 200px;
	border-radius: 20px; background: rgba(255, 255, 255, 0.92); border: 1px solid var(--tyl-line);
	box-shadow: 0 12px 30px -18px rgba(13, 16, 51, 0.25);
}
.tyl-phase.is-ready:first-child { border-color: #cdd3ff; box-shadow: 0 0 0 4px rgba(59, 91, 253, 0.08), 0 18px 40px -20px rgba(59, 91, 253, 0.45); }
.tyl-phase.is-locked { background: rgba(255, 255, 255, 0.6); }
.tyl-phase-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.tyl-phase-num {
	display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 12px;
	background: var(--tyl-ink); color: #fff; font-size: 13px; font-weight: 700; letter-spacing: 0.02em;
}
.tyl-phase.is-ready .tyl-phase-num, .tyl-phase.is-done .tyl-phase-num { background: var(--tyl-grad); }
.tyl-phase.is-locked .tyl-phase-num { background: var(--tyl-line-strong); color: var(--tyl-muted); }
.tyl-phase-label { flex: 1 1 140px; font-weight: 700; color: var(--tyl-ink); }
.tyl-phase-text { color: var(--tyl-muted); flex: 1; }
.tyl-phase .tyl-btn { align-self: flex-start; }
.tyl-phase-result { display: flex; align-items: center; gap: 16px; }
.tyl-phase-big { font-size: 20px; font-weight: 700; color: var(--tyl-ink); }

/* Level badges */
.tyl-badge {
	display: inline-flex; align-items: center; justify-content: center; min-width: 2.6em; padding: 3px 10px;
	border-radius: 10px; background: var(--tyl-grad); color: #fff; font-weight: 700; letter-spacing: 0.01em; line-height: 1.4;
}
.tyl-badge-big {
	min-width: 76px; height: 76px; padding: 0 14px; border-radius: 22px; font-size: 28px; letter-spacing: -0.02em;
	box-shadow: var(--tyl-glow);
}
.tyl-badge-muted { background: var(--tyl-soft); color: var(--tyl-faint); box-shadow: none; }

/* ---------------------------------------------------------------- Results */

.tyl-legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; font-weight: 500; color: var(--tyl-muted); }
.tyl-legend > span { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--tyl-soft); }

.tyl-headline {
	display: flex; align-items: center; gap: 28px; flex-wrap: wrap; margin-bottom: 8px;
	padding: 24px; border-radius: 20px; background: var(--tyl-grad-soft); border: 1px solid #e7e4fb;
}
.tyl-evolution { display: flex; align-items: center; gap: 14px; }
.tyl-evo-side { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tyl-evo-side:first-child .tyl-badge { background: #fff; color: var(--tyl-ink); border: 1px solid var(--tyl-line-strong); box-shadow: none; }
.tyl-evo-arrow {
	display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-top: 22px;
	border-radius: 999px; background: #fff; color: var(--tyl-indigo); box-shadow: var(--tyl-shadow);
}
.tyl-headline-copy { flex: 1 1 260px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.tyl-headline-text { font-size: 19px; font-weight: 600; line-height: 1.45; color: var(--tyl-ink); }

.tyl-rows { margin-top: 8px; }
.tyl-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 112px; align-items: center; gap: 20px; padding: 26px 0 16px; border-top: 1px solid var(--tyl-line); }
.tyl-row:first-child { border-top: 0; }
.tyl-row-label { display: flex; align-items: center; gap: 12px; font-weight: 600; color: var(--tyl-ink); }
.tyl-row-levels { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tyl-lv { display: inline-flex; min-width: 36px; justify-content: center; padding: 3px 8px; border-radius: 8px; background: var(--tyl-soft); color: var(--tyl-muted); font-weight: 600; font-size: 14px; }
.tyl-lv-strong { background: var(--tyl-tint); color: var(--tyl-blue); }
.tyl-arrow { color: var(--tyl-faint); width: 16px; height: 16px; }

.tyl-track { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; height: 10px; margin-top: 14px; }
.tyl-seg { position: relative; background: #eceefa; }
.tyl-seg:first-child { border-radius: 6px 0 0 6px; }
.tyl-seg:nth-child(6) { border-radius: 0 6px 6px 0; }
.tyl-seg-label { position: absolute; left: 0; right: 0; top: -20px; text-align: center; font-size: 11px; font-weight: 600; line-height: 1; color: var(--tyl-faint); letter-spacing: 0.04em; }
.tyl-link { position: absolute; top: 0; height: 10px; background: var(--tyl-grad); border-radius: 6px; opacity: 0.85; }
.tyl-link.is-down { background: linear-gradient(90deg, #ffb199, var(--tyl-coral)); }
.tyl-dot { position: absolute; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; }
.tyl-dot-before { background: #fff; border: 3px solid var(--tyl-indigo); box-shadow: 0 2px 6px rgba(13, 16, 51, 0.15); }
.tyl-dot-after { background: var(--tyl-grad); border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(90, 92, 246, 0.3), 0 4px 10px rgba(90, 92, 246, 0.45); }
.tyl-dot-inline { position: static; display: inline-block; width: 14px; height: 14px; margin: 0; border-width: 2px; }

.tyl-feedback { margin-top: 28px; }
.tyl-fb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.tyl-fb { padding: 18px; border-radius: var(--tyl-radius-md); background: var(--tyl-soft); border: 1px solid var(--tyl-line); }
.tyl-fb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--tyl-ink); }
.tyl-fb p { font-size: 0.95em; color: var(--tyl-text); }

/* ---------------------------------------------------------------- Test frame */

.tyl-test { padding: 28px 32px 0; }
.tyl-testbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.tyl-testbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.tyl-testbar-name { font-weight: 700; color: var(--tyl-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

.tyl-app .tyl-stepper { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 6px; border-radius: 20px; background: var(--tyl-soft); border: 1px solid var(--tyl-line); }
.tyl-app .tyl-stepper li { margin: 0; padding: 0; min-width: 0; }
.tyl-app .tyl-step {
	display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; margin: 0; padding: 8px 12px;
	border: 0; border-radius: 14px; background: transparent; color: var(--tyl-muted); box-shadow: none;
	font-family: var(--tyl-font); font-size: 14px; font-weight: 500; text-align: left; text-transform: none; letter-spacing: 0;
	cursor: pointer; transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.tyl-app .tyl-step:hover { background: rgba(255, 255, 255, 0.7); color: var(--tyl-ink); }
.tyl-app .tyl-step.is-current { background: #fff; color: var(--tyl-ink); box-shadow: 0 6px 18px -8px rgba(13, 16, 51, 0.2); }
.tyl-step-ico { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px; border-radius: 12px; background: #fff; color: var(--tyl-faint); font-size: 17px; border: 1px solid var(--tyl-line); }
.tyl-step.is-current .tyl-step-ico { background: var(--tyl-grad); color: #fff; border-color: transparent; box-shadow: var(--tyl-glow); }
.tyl-step-check { position: absolute; right: -5px; bottom: -5px; display: none; width: 18px; height: 18px; padding: 3px; border-radius: 999px; background: var(--tyl-green); color: #fff; border: 2px solid #fff; }
.tyl-step-check .tyl-ico { width: 100%; height: 100%; }
.tyl-step.is-complete .tyl-step-check { display: inline-flex; }
.tyl-step-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.tyl-step-num { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tyl-faint); }
.tyl-step-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tyl-progressbar { height: 4px; margin: 14px 6px 0; border-radius: 4px; background: var(--tyl-line); overflow: hidden; }
.tyl-progressbar > span { display: block; height: 100%; border-radius: 4px; background: var(--tyl-grad); transition: width 0.4s ease; }

.tyl-stage-head { display: flex; align-items: center; gap: 18px; margin: 30px 0 8px; }
.tyl-stage-copy { flex: 1; min-width: 0; }
.tyl-stage-copy .tyl-lead { margin-top: 4px; }
.tyl-answered { flex: none; align-self: flex-start; padding: 7px 14px; border-radius: 999px; background: var(--tyl-soft); color: var(--tyl-muted); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tyl-answered.is-complete { background: var(--tyl-green-soft); color: #0b7f5b; }

.tyl-items { display: flex; flex-direction: column; gap: 20px; padding: 20px 0 8px; }
.tyl-item { padding: 26px; border-radius: 20px; background: var(--tyl-surface); border: 1px solid var(--tyl-line); }
.tyl-item-kicker { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tyl-app .tyl-item-title { width: 100%; margin: 2px 0 0; font-size: 20px; font-weight: 700; }

.tyl-nav {
	position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px;
	margin: 12px -32px 0; padding: 16px 32px; border-top: 1px solid var(--tyl-line);
	background: rgba(255, 255, 255, 0.9); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
	border-radius: 0 0 var(--tyl-radius) var(--tyl-radius);
}

/* ---------------------------------------------------------------- Questions */

.tyl-qs { display: flex; flex-direction: column; gap: 22px; }
.tyl-app .tyl-q { margin: 0; padding: 0; border: 0; min-width: 0; }
.tyl-app .tyl-q legend { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 0; margin: 0 0 12px; font-weight: 600; font-size: 16.5px; line-height: 1.45; color: var(--tyl-ink); }
.tyl-q-num { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 9px; background: var(--tyl-ink); color: #fff; font-size: 13px; font-weight: 700; }
.tyl-q-text { padding-top: 2px; }
.tyl-opts { display: grid; grid-template-columns: 1fr; gap: 10px; }
@container tyl (min-width: 640px) {
	.tyl-opts { grid-template-columns: 1fr 1fr; }
}
.tyl-app .tyl-opt {
	position: relative; display: flex; align-items: center; gap: 14px; margin: 0; padding: 12px 16px; min-height: 58px;
	border: 1.5px solid var(--tyl-line); border-radius: var(--tyl-radius-md); background: #fff;
	font-weight: 500; color: var(--tyl-text); cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.tyl-app .tyl-opt:hover { border-color: #c4caff; background: #fafaff; }
.tyl-app .tyl-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.tyl-opt-key {
	display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 10px;
	background: var(--tyl-soft); color: var(--tyl-muted); font-size: 14px; font-weight: 700; transition: all 0.15s ease;
}
.tyl-opt-text { line-height: 1.4; }
.tyl-app .tyl-opt:has(input:checked) { border-color: var(--tyl-indigo); background: linear-gradient(135deg, #f3f4ff, #f8f2ff); box-shadow: 0 8px 22px -14px rgba(90, 92, 246, 0.6); }
.tyl-app .tyl-opt:has(input:checked) .tyl-opt-key { background: var(--tyl-grad); color: #fff; }
.tyl-app .tyl-opt:has(input:checked) .tyl-opt-text { color: var(--tyl-ink); font-weight: 600; }
.tyl-app .tyl-opt:has(input:focus-visible) { outline: 3px solid rgba(90, 92, 246, 0.45); outline-offset: 2px; }

/* ---------------------------------------------------------------- Listening */

.tyl-listen-stage {
	position: relative; margin-bottom: 26px; padding: 20px; border-radius: 20px;
	background: var(--tyl-grad-soft); border: 1px solid #e7e4fb;
}
.tyl-window-dots { display: flex; gap: 7px; margin-bottom: 12px; }
.tyl-window-dots span { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.tyl-window-dots span:nth-child(2) { background: #febc2e; }
.tyl-window-dots span:nth-child(3) { background: #28c840; }
.tyl-listen-hint { margin-bottom: 14px; color: var(--tyl-muted); font-size: 14px; }

.tyl-player {
	display: flex; align-items: center; gap: 18px; padding: 14px 20px 14px 14px; border-radius: 20px;
	background: var(--tyl-grad); color: #fff; box-shadow: 0 18px 40px -18px rgba(90, 92, 246, 0.75);
}
.tyl-app .tyl-play {
	display: inline-flex; align-items: center; justify-content: center; flex: none; width: 60px; height: 60px; margin: 0; padding: 0;
	border: 0; border-radius: 999px; background: #fff; color: var(--tyl-indigo); box-shadow: 0 8px 20px -6px rgba(13, 16, 51, 0.35);
	font-size: 24px; cursor: pointer; transition: transform 0.15s ease;
}
.tyl-app .tyl-play:hover { transform: scale(1.05); background: #fff; color: var(--tyl-indigo); }
.tyl-app .tyl-play .tyl-ico { width: 24px; height: 24px; }
.tyl-player:not(.is-playing) .tyl-play .tyl-ico { margin-left: 3px; }
.tyl-wave { flex: 1; min-width: 0; height: 58px; display: flex; align-items: center; cursor: pointer; }
.tyl-bars { display: flex; align-items: center; justify-content: space-between; gap: 3px; width: 100%; height: 100%; }
.tyl-b { flex: 1; max-width: 5px; min-height: 4px; border-radius: 3px; background: rgba(255, 255, 255, 0.45); transform-origin: center; transition: background-color 0.2s ease; }
.tyl-b.is-lit { background: #fff; }
.tyl-player.is-playing .tyl-b { animation: tyl-bar 1.1s ease-in-out infinite; }
.tyl-time { flex: none; min-width: 84px; text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.92); }
.tyl-player-compact { padding: 10px 16px 10px 10px; gap: 14px; box-shadow: none; }
.tyl-player-compact .tyl-play { width: 46px; height: 46px; }
.tyl-player-compact .tyl-play .tyl-ico { width: 19px; height: 19px; }
.tyl-player-compact .tyl-wave { height: 40px; }

/* ---------------------------------------------------------------- Reading */

.tyl-read-grid { display: grid; grid-template-columns: 1fr; gap: 26px; }
@container tyl (min-width: 860px) {
	.tyl-read-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
	.tyl-passage-col { position: sticky; top: 12px; }
	.tyl-read .tyl-opts { grid-template-columns: 1fr; }
}
.tyl-passage {
	padding: 24px 26px; border-radius: 18px; background: #fbfbfe; border: 1px solid var(--tyl-line);
	font-size: 16.5px; line-height: 1.8; color: var(--tyl-ink);
}
.tyl-passage p { margin: 0 0 0.9em; }
.tyl-passage p:last-child { margin-bottom: 0; }
.tyl-passage-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 13px; font-weight: 500; color: var(--tyl-faint); }

/* ---------------------------------------------------------------- Writing */

.tyl-prompt-lg { margin: 0 0 18px; font-size: 19px; font-weight: 600; line-height: 1.5; color: var(--tyl-ink); white-space: pre-line; }
.tyl-write-box { border: 1.5px solid var(--tyl-line); border-radius: 18px; background: #fff; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.tyl-write-box:focus-within { border-color: var(--tyl-indigo); box-shadow: 0 0 0 5px rgba(90, 92, 246, 0.12); }
.tyl-app .tyl-textarea {
	display: block; width: 100%; min-height: 220px; margin: 0; padding: 20px 22px; border: 0; border-radius: 18px 18px 0 0; outline: 0;
	background: transparent; color: var(--tyl-ink); box-shadow: none;
	font-family: var(--tyl-font); font-size: 16.5px; line-height: 1.7; resize: vertical;
}
.tyl-app .tyl-textarea::placeholder { color: var(--tyl-faint); }
.tyl-app .tyl-textarea:focus { outline: 0; box-shadow: none; border: 0; }
.tyl-write-foot { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-top: 1px solid var(--tyl-line); font-size: 13px; color: var(--tyl-muted); }
.tyl-count { font-weight: 700; color: var(--tyl-ink); font-variant-numeric: tabular-nums; min-width: 70px; }
.tyl-meter { flex: 1; height: 6px; border-radius: 6px; background: var(--tyl-soft); overflow: hidden; }
.tyl-meter > span { display: block; height: 100%; border-radius: 6px; background: var(--tyl-grad); transition: width 0.25s ease; }
.tyl-meter.is-met > span { background: linear-gradient(90deg, #20c08f, var(--tyl-green)); }
.tyl-goal { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.tyl-meter.is-met + .tyl-goal { color: var(--tyl-green); }

/* ---------------------------------------------------------------- Speaking */

.tyl-speak-prompt { margin: 0 0 20px; font-size: clamp(20px, 3vw, 26px); font-weight: 700; line-height: 1.35; letter-spacing: -0.02em; color: var(--tyl-ink); white-space: pre-line; }
.tyl-speak-wave {
	position: relative; display: flex; align-items: center; justify-content: center; min-height: 96px; padding: 18px 22px;
	border-radius: 20px; background: var(--tyl-grad); overflow: hidden;
}
.tyl-speak-wave.is-idle { background: linear-gradient(100deg, #eef0ff, #f6efff); }
.tyl-speak-wave.is-idle .tyl-bars { height: 52px; opacity: 0.9; }
.tyl-speak-wave.is-idle .tyl-b { background: rgba(90, 92, 246, 0.2); }
.tyl-speak-idle { position: absolute; padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.9); color: var(--tyl-muted); font-size: 13px; font-weight: 600; }
.tyl-speak-wave.is-done { padding: 6px; background: transparent; }
.tyl-speak-wave.is-done .tyl-player { width: 100%; }
.tyl-canvas { display: block; width: 100%; height: 64px; }
.tyl-rec-progress { position: absolute; left: 22px; right: 22px; bottom: 10px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.3); overflow: hidden; }
.tyl-rec-progress > span { display: block; width: 0; height: 100%; background: #fff; transition: width 0.25s linear; }

.tyl-speak-controls { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 18px; }
.tyl-app .tyl-mic {
	position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; width: 72px; height: 72px; margin: 6px; padding: 0;
	border: 0; border-radius: 999px; background: linear-gradient(135deg, #ff8a5c, #f4594a); color: #fff;
	box-shadow: 0 0 0 8px var(--tyl-coral-soft), 0 14px 30px -10px rgba(244, 89, 74, 0.7);
	font-size: 28px; cursor: pointer; transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.tyl-app .tyl-mic:hover { transform: scale(1.04); background: linear-gradient(135deg, #ff8a5c, #f4594a); color: #fff; }
.tyl-app .tyl-mic .tyl-ico { width: 28px; height: 28px; }
.tyl-app .tyl-mic:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.tyl-app .tyl-mic.is-recording { animation: tyl-halo 1.6s ease-out infinite; }
.tyl-speak-chips { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tyl-speak-cta { font-weight: 700; color: var(--tyl-ink); }
.tyl-chip-live { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px; border-radius: 999px; background: var(--tyl-coral-soft); color: #c8462a; font-weight: 700; font-variant-numeric: tabular-nums; }
.tyl-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--tyl-coral); animation: tyl-pulse 1s ease-in-out infinite; }
.tyl-speak.is-recording { border-color: #ffd0c2; box-shadow: 0 0 0 4px rgba(246, 112, 79, 0.08); }
.tyl-speak .tyl-alert { margin-top: 14px; }

/* ---------------------------------------------------------------- Submitting */

.tyl-orb {
	position: relative; display: inline-flex; align-items: center; justify-content: center; width: 76px; height: 76px; margin: 0 auto 22px;
	border-radius: 999px; background: var(--tyl-grad); color: #fff; font-size: 30px; box-shadow: var(--tyl-glow);
}
.tyl-orb::before { content: ""; position: absolute; inset: -8px; border-radius: 999px; border: 3px solid transparent; border-top-color: var(--tyl-violet); border-right-color: var(--tyl-blue); animation: tyl-spin 1.1s linear infinite; }

/* ---------------------------------------------------------------- Speaking report */

.tyl-report { margin-top: 28px; border: 1px solid var(--tyl-line); border-radius: 20px; background: #fff; overflow: hidden; }
.tyl-report > summary { display: flex; align-items: center; gap: 14px; padding: 18px 20px; cursor: pointer; list-style: none; }
.tyl-report > summary::-webkit-details-marker { display: none; }
.tyl-report > summary:hover { background: #fafaff; }
.tyl-report-title { flex: 1; display: flex; flex-direction: column; gap: 2px; color: var(--tyl-ink); }
.tyl-chev { color: var(--tyl-faint); transition: transform 0.2s ease; }
.tyl-report[open] > summary { border-bottom: 1px solid var(--tyl-line); }
.tyl-report[open] .tyl-chev { transform: rotate(90deg); }
.tyl-report > :not(summary) { margin-left: 22px; margin-right: 22px; }
.tyl-report[open] > :last-child { margin-bottom: 22px; }
.tyl-report-head { display: flex; flex-wrap: wrap; gap: 32px; align-items: center; margin-top: 22px; margin-bottom: 14px; }
.tyl-stat { display: flex; flex-direction: column; gap: 6px; }
.tyl-stat-num { font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; background: var(--tyl-grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.tyl-stat-label { font-size: 13px; color: var(--tyl-muted); }
.tyl-table-wrap { overflow-x: auto; margin-top: 16px; margin-bottom: 16px; border: 1px solid var(--tyl-line); border-radius: var(--tyl-radius-md); }
.tyl-app .tyl-table { width: 100%; border-collapse: collapse; font-size: 14.5px; margin: 0; border: 0; }
.tyl-app .tyl-table th, .tyl-app .tyl-table td { text-align: left; padding: 11px 16px; border: 0; border-bottom: 1px solid var(--tyl-line); background: transparent; color: var(--tyl-text); }
.tyl-app .tyl-table tr:last-child td { border-bottom: 0; }
.tyl-app .tyl-table th { background: var(--tyl-soft); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tyl-muted); }
.tyl-app .tyl-table .tyl-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tyl-app .tyl-table th:not(:first-child) { text-align: right; }
.tyl-row-strong td { font-weight: 700; color: var(--tyl-ink); }
.tyl-bar { display: inline-block; width: 110px; height: 8px; border-radius: 6px; background: var(--tyl-soft); vertical-align: middle; overflow: hidden; }
.tyl-bar > span { display: block; height: 100%; border-radius: 6px; background: var(--tyl-grad); }
.tyl-up, .tyl-app .tyl-table td.tyl-up { color: var(--tyl-green); font-weight: 700; }
.tyl-down, .tyl-app .tyl-table td.tyl-down { color: var(--tyl-red); font-weight: 700; }
.tyl-app .tyl-list { margin: 0 0 8px; padding: 0; list-style: none; }
.tyl-app .tyl-list li { position: relative; margin: 8px 0; padding-left: 22px; }
.tyl-app .tyl-list li::before { content: ""; position: absolute; left: 4px; top: 0.65em; width: 7px; height: 7px; border-radius: 50%; background: var(--tyl-grad); }
.tyl-report del { color: var(--tyl-red); text-decoration-thickness: 1.5px; }
.tyl-report .tyl-h4 { margin-top: 24px; }
.tyl-report .tyl-passage { font-size: 15.5px; padding: 16px 18px; margin-bottom: 10px; }

/* ---------------------------------------------------------------- Course-page button */

.tyl-cta { margin: 14px 0; font-family: var(--tyl-font); }
.tyl-cta-note { margin: 10px 0 0; font-size: 13px; line-height: 1.45; color: #676d8a; }
.tyl-cta-entry, .tyl-cta-sidebar_top { text-align: center; }
.tyl-cta-entry .tyl-open-btn, .tyl-cta-sidebar_top .tyl-open-btn { width: 100%; }
.tyl-cta-sidebar_top {
	margin: 0 0 24px; padding: 20px; border-radius: 20px; border: 1px solid #e3e5fb;
	background: radial-gradient(320px 160px at 0% 0%, rgba(59, 91, 253, 0.12), transparent 70%), radial-gradient(320px 160px at 100% 0%, rgba(176, 94, 240, 0.14), transparent 70%), #fff;
}
.tyl-cta-content_top { margin: 0 0 24px; }
.tyl-open-btn { min-height: 52px; padding: 14px 26px; font-size: 16px; }
.tyl-open-btn::before {
	content: ""; width: 18px; height: 18px; flex: none;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l1.8 4.7 4.7 1.8-4.7 1.8L12 16l-1.8-4.7-4.7-1.8 4.7-1.8z'/%3E%3Cpath d='M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l1.8 4.7 4.7 1.8-4.7 1.8L12 16l-1.8-4.7-4.7-1.8 4.7-1.8z'/%3E%3Cpath d='M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------------------------------------------------------------- Dialog */

.tyl-dialog {
	width: min(1040px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
	padding: 0; border: 0; border-radius: 28px; background: #f6f6fd; color: var(--tyl-text);
	box-shadow: 0 40px 120px -20px rgba(13, 16, 51, 0.55); overflow: hidden; font-family: var(--tyl-font);
}
.tyl-dialog[open] { display: flex; flex-direction: column; animation: tyl-pop 0.22s ease-out; }
.tyl-dialog::backdrop { background: rgba(13, 16, 51, 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.tyl-dialog-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 14px 26px; background: #fff; border-bottom: 1px solid var(--tyl-line); }
.tyl-dialog-title { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--tyl-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tyl-dialog-title::before { content: ""; width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--tyl-grad); box-shadow: 0 0 0 4px var(--tyl-tint); }
.tyl-dialog-close {
	flex: none; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; padding: 0;
	border: 0; border-radius: 999px; background: var(--tyl-soft); color: var(--tyl-ink); font-size: 24px; line-height: 1; cursor: pointer;
}
.tyl-dialog-close:hover { background: var(--tyl-line); }
.tyl-dialog-body { overflow-y: auto; padding: 22px; overscroll-behavior: contain; }
.tyl-dialog .tyl-app { margin: 0; max-width: none; }
body:has(.tyl-dialog[open]) { overflow: hidden; }

/* ---------------------------------------------------------------- Motion */

@keyframes tyl-spin { to { transform: rotate(360deg); } }
@keyframes tyl-pulse { 50% { opacity: 0.25; } }
@keyframes tyl-bar { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(0.55); } }
@keyframes tyl-halo {
	0% { box-shadow: 0 0 0 0 rgba(246, 112, 79, 0.45), 0 14px 30px -10px rgba(244, 89, 74, 0.7); }
	100% { box-shadow: 0 0 0 18px rgba(246, 112, 79, 0), 0 14px 30px -10px rgba(244, 89, 74, 0.7); }
}
@keyframes tyl-pop { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
	.tyl-app *, .tyl-dialog, .tyl-dialog * { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------- Narrow screens */

@container tyl (max-width: 700px) {
	.tyl-app .tyl-step { justify-content: center; padding: 8px; min-height: 52px; }
	.tyl-step-text { display: none; }
	.tyl-bars { gap: 2px; }
	.tyl-b:nth-child(n+33) { display: none; }
	.tyl-player-compact .tyl-b:nth-child(n+25) { display: none; }
}
@container tyl (max-width: 600px) {
	.tyl-card, .tyl-hero { padding: 22px 18px; border-radius: 20px; }
	.tyl-test { padding: 18px 16px 0; }
	.tyl-nav { margin: 8px -16px 0; padding: 12px 16px; border-radius: 0 0 20px 20px; }
	.tyl-nav .tyl-btn-lg { padding: 12px 18px; font-size: 15px; }
	.tyl-phases { grid-template-columns: 1fr; }
	.tyl-phase { min-height: 0; }
	.tyl-item { padding: 18px 16px; border-radius: 18px; }
	.tyl-listen-stage { padding: 14px; }
	.tyl-player { gap: 12px; padding: 10px 14px 10px 10px; }
	.tyl-app .tyl-play { width: 50px; height: 50px; }
	.tyl-time { min-width: 0; font-size: 12px; }
	.tyl-stage-head { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: start; gap: 6px 14px; margin-top: 22px; }
	.tyl-stage-head .tyl-tile-big { width: 48px; height: 48px; border-radius: 15px; font-size: 22px; }
	.tyl-app .tyl-h { font-size: 22px; }
	.tyl-answered { grid-column: 2; justify-self: start; }
	.tyl-time { display: none; }
	.tyl-player.is-playing .tyl-time { display: block; }
	.tyl-row { grid-template-columns: 1fr auto; gap: 8px 12px; padding-top: 18px; }
	.tyl-row .tyl-track { grid-column: 1 / -1; grid-row: 2; margin-top: 24px; }
	.tyl-headline { padding: 18px; gap: 18px; }
	.tyl-badge-big { min-width: 64px; height: 64px; font-size: 24px; border-radius: 18px; }
	.tyl-headline-text { font-size: 17px; }
	.tyl-passage { padding: 18px; font-size: 16px; }
	.tyl-write-foot { flex-wrap: wrap; }
	.tyl-meter { flex-basis: 100%; order: 3; }
	.tyl-report > :not(summary) { margin-left: 14px; margin-right: 14px; }
	.tyl-app .tyl-table th, .tyl-app .tyl-table td { padding: 9px 10px; }
	.tyl-bar { width: 56px; }
	.tyl-testbar-title .tyl-pill { display: none; }
}
@media (max-width: 600px) {
	.tyl-dialog { width: 100vw; max-height: 100vh; max-height: 100dvh; height: 100dvh; border-radius: 0; }
	.tyl-dialog-body { padding: 12px; }
	.tyl-dialog-bar { padding: 10px 12px 10px 18px; }
}
