.ath-typing-speed {
	--ath-typing-text: var(--text-high);
	--ath-typing-muted: var(--text-mid);
	--ath-typing-low: var(--text-low);
	--ath-typing-surface: var(--surface-1);
	--ath-typing-raised: var(--surface-2);
	--ath-typing-panel: var(--surface-3);
	--ath-typing-line: var(--border);
	--ath-typing-accent: var(--ctl-c1);
	--ath-typing-accent-2: var(--ctl-c2);
	--ath-typing-gold: var(--ctl-c3);
	--ath-typing-positive: var(--ctl-c2);
	--ath-typing-negative: var(--ctl-c4);
	--ath-typing-shadow: var(--ctl-c6);
	--ath-typing-focus: var(--focus-ring);
	--ath-typing-button-bg: var(--btn-bg);
	--ath-typing-button-fg: var(--btn-fg);
	--ath-typing-button-shadow: var(--btn-shadow);
	--ath-typing-frame: color-mix(in srgb, var(--ath-typing-accent) 44%, var(--ath-typing-line));
	--ath-typing-frame-soft: color-mix(in srgb, var(--ath-typing-accent) 24%, var(--ath-typing-line));
	position: relative;
	box-sizing: border-box;
	container-type: inline-size;
	width: 100%;
	min-width: 0;
	overflow: hidden;
	isolation: isolate;
	color: var(--ath-typing-text);
	background:
		radial-gradient(circle at 6% 0%, color-mix(in srgb, var(--ath-typing-accent) 25%, transparent), transparent 32%),
		radial-gradient(circle at 96% 90%, color-mix(in srgb, var(--ath-typing-gold) 17%, transparent), transparent 34%),
		linear-gradient(145deg, color-mix(in srgb, var(--ath-typing-surface) 94%, var(--ath-typing-accent) 6%), color-mix(in srgb, var(--ath-typing-raised) 84%, var(--ath-typing-accent-2) 16%));
	border-block: 1px solid color-mix(in srgb, var(--ath-typing-accent) 32%, var(--ath-typing-line));
}

.ath-typing-speed,
.ath-typing-speed * { box-sizing: border-box; }

.ath-typing-speed__noise,
.ath-typing-speed__confetti {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.ath-typing-speed__noise {
	z-index: -1;
	opacity: .1;
	background-image: radial-gradient(color-mix(in srgb, var(--ath-typing-text) 25%, transparent) .7px, transparent .7px);
	background-size: 18px 18px;
	mix-blend-mode: screen;
}

.ath-typing-speed__confetti {
	z-index: 4;
	display: block;
	width: 100%;
	height: 100%;
}

.ath-typing-speed__inner {
	position: relative;
	z-index: 1;
	width: min(100%, 1120px);
	margin-inline: auto;
	padding: clamp(18px, 3.5vw, 42px) clamp(14px, 3.5vw, 42px) clamp(20px, 3vw, 34px);
}

.ath-typing-speed__topline,
.ath-typing-speed__targetLabel,
.ath-typing-speed__toolbar,
.ath-typing-speed__actions,
.ath-typing-speed__resultActions {
	display: flex;
	align-items: center;
}

.ath-typing-speed__topline {
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 15px;
}

.ath-typing-speed__eyebrow,
.ath-typing-speed__duration,
.ath-typing-speed__targetLabel,
.ath-typing-speed__inputLabel > span,
.ath-typing-speed__metrics small,
.ath-typing-speed__resultMetrics small {
	font-size: 10px;
	font-weight: 850;
	letter-spacing: .11em;
	line-height: 1.15;
	text-transform: uppercase;
}

.ath-typing-speed__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: color-mix(in srgb, var(--ath-typing-accent) 78%, var(--ath-typing-text));
}

.ath-typing-speed__pulse {
	display: inline-block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--ath-typing-accent);
	box-shadow: 0 0 0 0 color-mix(in srgb, var(--ath-typing-accent) 48%, transparent);
	animation: ath-typing-pulse 2s ease-out infinite;
}

.ath-typing-speed__duration {
	color: var(--ath-typing-muted);
}

.ath-typing-speed__duration span { color: var(--ath-typing-gold); }

.ath-typing-speed__targetWrap {
	position: relative;
	padding: clamp(14px, 2.4vw, 24px);
	border: 1px solid var(--ath-typing-frame);
	border-radius: 18px;
	background: color-mix(in srgb, var(--ath-typing-raised) 76%, transparent);
	box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ath-typing-text) 8%, transparent), 0 0 0 1px color-mix(in srgb, var(--ath-typing-accent) 8%, transparent), 0 18px 42px color-mix(in srgb, var(--ath-typing-shadow) 14%, transparent);
}

.ath-typing-speed__targetLabel {
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
	color: var(--ath-typing-muted);
}

.ath-typing-speed__targetLabel span:last-child {
	color: var(--ath-typing-gold);
	font-size: 9px;
	letter-spacing: .04em;
	text-transform: none;
}

.ath-typing-speed__target {
	min-height: 76px;
	color: var(--ath-typing-text);
	font-size: clamp(19px, 2.7vw, 31px);
	font-weight: 750;
	letter-spacing: -.025em;
	line-height: 1.22;
	white-space: pre-wrap;
	word-break: break-word;
}

.ath-typing-speed__target span {
	position: relative;
	transition: color .12s ease, background-color .12s ease, text-shadow .12s ease;
}

.ath-typing-speed__target span.is-remaining { color: color-mix(in srgb, var(--ath-typing-muted) 64%, transparent); }
.ath-typing-speed__target span.is-correct { color: var(--ath-typing-positive); text-shadow: 0 0 12px color-mix(in srgb, var(--ath-typing-positive) 28%, transparent); }
.ath-typing-speed__target span.is-incorrect { color: var(--ath-typing-negative); text-decoration: underline wavy; text-underline-offset: 4px; }
.ath-typing-speed__target span.is-current { color: var(--ath-typing-text); background: color-mix(in srgb, var(--ath-typing-accent) 28%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ath-typing-accent) 10%, transparent); }

.ath-typing-speed__progress {
	height: 4px;
	margin-top: 20px;
	overflow: hidden;
	border-radius: 999px;
	background: color-mix(in srgb, var(--ath-typing-line) 65%, transparent);
}

.ath-typing-speed__progress span {
	display: block;
	width: 0;
	height: 100%;
	border-radius: inherit;
	background: linear-gradient(90deg, var(--ath-typing-accent), var(--ath-typing-gold));
	transition: width .16s linear;
}

.ath-typing-speed__work {
	display: grid;
	grid-template-columns: minmax(0, 1.5fr) minmax(260px, .8fr);
	gap: 12px;
	margin-top: 12px;
}

.ath-typing-speed__inputLabel {
	display: block;
	min-width: 0;
	padding: 14px;
	border: 1px solid var(--ath-typing-frame-soft);
	border-radius: 15px;
	background: color-mix(in srgb, var(--ath-typing-surface) 78%, transparent);
	box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ath-typing-text) 5%, transparent), 0 0 0 1px color-mix(in srgb, var(--ath-typing-accent) 6%, transparent);
	transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.ath-typing-speed__inputLabel > span {
	display: block;
	margin-bottom: 9px;
	color: var(--ath-typing-muted);
}

.ath-typing-speed textarea {
	display: block;
	width: 100%;
	min-height: 100px;
	padding: 0;
	resize: vertical;
	color: var(--ath-typing-text);
	font: inherit;
	font-size: 17px;
	font-weight: 620;
	line-height: 1.45;
	border: 0;
	outline: 0;
	background: transparent;
	caret-color: var(--ath-typing-accent);
}

.ath-typing-speed textarea::placeholder { color: var(--ath-typing-low); }
.ath-typing-speed textarea:disabled { cursor: not-allowed; opacity: .48; }
.ath-typing-speed__inputLabel:focus-within { border-color: var(--ath-typing-accent); background: color-mix(in srgb, var(--ath-typing-accent) 8%, var(--ath-typing-surface)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ath-typing-focus) 60%, transparent); }

.ath-typing-speed__side {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-rows: auto auto;
	gap: 12px 0;
	min-width: 0;
}

.ath-typing-speed__metrics,
.ath-typing-speed__results {
	border: 1px solid var(--ath-typing-frame-soft);
	border-radius: 15px;
	background: color-mix(in srgb, var(--ath-typing-panel) 78%, transparent);
	box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ath-typing-text) 6%, transparent), 0 0 0 1px color-mix(in srgb, var(--ath-typing-accent) 5%, transparent);
}

.ath-typing-speed__metrics {
	grid-column: 1 / -1;
	grid-row: 1;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
	padding: 12px;
}

.ath-typing-speed__metrics span,
.ath-typing-speed__resultMetrics span {
	display: grid;
	gap: 4px;
	min-width: 0;
}

.ath-typing-speed__metrics span + span,
.ath-typing-speed__resultMetrics span + span { padding-left: 10px; border-left: 1px solid color-mix(in srgb, var(--ath-typing-accent) 20%, var(--ath-typing-line)); }
.ath-typing-speed__metrics strong { color: var(--ath-typing-text); font-size: clamp(17px, 2.4vw, 24px); font-weight: 850; letter-spacing: -.04em; line-height: 1; }
.ath-typing-speed__metrics small,
.ath-typing-speed__resultMetrics small { color: var(--ath-typing-muted); font-size: 8px; letter-spacing: .08em; }

.ath-typing-speed__toolbar {
	grid-column: 1;
	grid-row: 2;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: auto auto;
	align-content: center;
	justify-items: center;
	gap: 6px;
	min-height: 76px;
	padding: 9px 10px;
	border: 1px solid var(--ath-typing-frame-soft);
	border-right: 0;
	border-radius: 13px 0 0 13px;
	background: color-mix(in srgb, var(--ath-typing-surface) 62%, transparent);
	box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ath-typing-text) 6%, transparent);
}

.ath-typing-speed__toolbar > span { grid-column: 1; grid-row: 2; width: 100%; max-width: none; color: var(--ath-typing-low); font-size: 10px; line-height: 1.3; text-align: center; }
.ath-typing-speed__sound,
.ath-typing-speed__button { font: inherit; cursor: pointer; }

.ath-typing-speed__sound {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 30px;
	padding: 0 8px;
	color: var(--ath-typing-button-fg);
	font-size: 10px;
	font-weight: 850;
	white-space: nowrap;
	border: 1px solid color-mix(in srgb, var(--ath-typing-gold) 55%, var(--ath-typing-line));
	border-radius: 8px;
	background: var(--ath-typing-button-bg);
}

.ath-typing-speed__soundIcon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.ath-typing-speed__soundIcon > path:first-child { fill: currentColor; stroke: none; }
.ath-typing-speed__soundSlash { display: none; }
.ath-typing-speed__sound[aria-pressed="false"] .ath-typing-speed__soundWaves { display: none; }
.ath-typing-speed__sound[aria-pressed="false"] .ath-typing-speed__soundSlash { display: block; }

.ath-typing-speed__actions { grid-column: 2; grid-row: 2; align-items: flex-start; align-self: stretch; gap: 8px; margin-top: 0; padding: 10px 10px 10px 0; border: 1px solid var(--ath-typing-frame-soft); border-left: 0; border-radius: 0 13px 13px 0; background: color-mix(in srgb, var(--ath-typing-surface) 62%, transparent); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ath-typing-text) 6%, transparent); }
.ath-typing-speed__button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 13px; color: var(--ath-typing-text); font-size: 11px; font-weight: 850; border: 1px solid var(--ath-typing-line); border-radius: 9px; background: transparent; text-decoration: none; transition: transform .18s ease, filter .18s ease, border-color .18s ease; }
.ath-typing-speed__button:hover { transform: translateY(-2px); filter: brightness(1.08); }
.ath-typing-speed__button:focus-visible,
.ath-typing-speed__sound:focus-visible { outline: 2px solid var(--ath-typing-accent); outline-offset: 2px; }
.ath-typing-speed__button--primary { color: var(--ath-typing-button-fg); border-color: color-mix(in srgb, var(--ath-typing-gold) 62%, var(--ath-typing-accent)); background: var(--ath-typing-button-bg); box-shadow: 0 8px 19px color-mix(in srgb, var(--ath-typing-button-shadow) 22%, transparent); }
.ath-typing-speed__button--finish { opacity: .76; }
.ath-typing-speed__button[disabled] { cursor: not-allowed; opacity: .42; transform: none; filter: none; }
.ath-typing-speed__button[hidden] { display: none; }

.ath-typing-speed__hint {
	min-height: 18px;
	margin: 11px 2px 0;
	color: var(--ath-typing-muted);
	font-size: 11px;
	line-height: 1.35;
}

.ath-typing-speed__hint[data-state="complete"] { color: var(--ath-typing-positive); }
.ath-typing-speed__hint[data-state="retry"] { color: var(--ath-typing-gold); }

.ath-typing-speed__results[hidden] { display: none; }
.ath-typing-speed__results {
	display: grid;
	place-items: center;
	margin-top: 14px;
	padding: clamp(20px, 4vw, 36px);
	text-align: center;
	background: linear-gradient(145deg, color-mix(in srgb, var(--ath-typing-accent) 11%, var(--ath-typing-panel)), color-mix(in srgb, var(--ath-typing-gold) 8%, var(--ath-typing-panel)));
	animation: ath-typing-reveal .42s cubic-bezier(.2,.8,.2,1) both;
}

.ath-typing-speed__resultIcon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 11px; color: var(--ath-typing-button-fg); font-size: 23px; font-weight: 900; border-radius: 50%; background: linear-gradient(135deg, var(--ath-typing-positive), var(--ath-typing-accent-2)); box-shadow: 0 0 0 7px color-mix(in srgb, var(--ath-typing-positive) 13%, transparent); }
.ath-typing-speed__resultEyebrow { color: var(--ath-typing-gold); font-size: 9px; font-weight: 900; letter-spacing: .14em; }
.ath-typing-speed__results h3 { margin: 7px 0 0; color: var(--ath-typing-text); font-size: clamp(21px, 3.8vw, 32px); font-weight: 900; letter-spacing: -.05em; line-height: 1; }
.ath-typing-speed__results > p { max-width: 600px; margin: 11px 0 0; color: var(--ath-typing-muted); font-size: 12px; line-height: 1.45; }

.ath-typing-speed__resultMetrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: min(100%, 520px); margin-top: 18px; padding: 13px; text-align: left; border: 1px solid color-mix(in srgb, var(--ath-typing-accent) 25%, var(--ath-typing-line)); border-radius: 12px; background: color-mix(in srgb, var(--ath-typing-surface) 56%, transparent); }
.ath-typing-speed__resultMetrics strong { color: var(--ath-typing-text); font-size: clamp(18px, 3vw, 26px); font-weight: 900; line-height: 1; }
.ath-typing-speed__ranking { width: min(100%, 520px); margin-top: 12px; padding: 10px 12px; color: var(--ath-typing-muted); font-size: 11px; line-height: 1.4; text-align: left; border: 1px solid color-mix(in srgb, var(--ath-typing-accent) 25%, var(--ath-typing-line)); border-radius: 10px; background: color-mix(in srgb, var(--ath-typing-accent) 8%, transparent); }
.ath-typing-speed__ranking strong { display: block; margin-bottom: 2px; color: var(--ath-typing-text); font-size: 12px; }
.ath-typing-speed__ranking[data-state="saved"] { border-color: color-mix(in srgb, var(--ath-typing-positive) 45%, var(--ath-typing-line)); }
.ath-typing-speed__ranking[data-state="error"] { color: var(--ath-typing-low); }
.ath-typing-speed__resultActions { justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

@keyframes ath-typing-pulse { 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes ath-typing-reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@container (max-width: 720px) {
	.ath-typing-speed__work { grid-template-columns: minmax(0, 1fr); }
	.ath-typing-speed__side { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
	.ath-typing-speed__toolbar,
	.ath-typing-speed__actions { grid-column: 1; grid-row: auto; }
	.ath-typing-speed__toolbar { border-right: 1px solid var(--ath-typing-frame-soft); border-radius: 13px 13px 0 0; }
	.ath-typing-speed__actions { align-self: auto; padding: 0 10px 10px; border-top: 0; border-left: 1px solid var(--ath-typing-frame-soft); border-radius: 0 0 13px 13px; }
}

@container (max-width: 500px) {
	.ath-typing-speed__topline { align-items: flex-start; flex-direction: column; gap: 8px; }
	.ath-typing-speed__targetLabel { align-items: flex-start; flex-direction: column; gap: 5px; }
	.ath-typing-speed__target { min-height: 104px; font-size: 20px; }
	.ath-typing-speed__metrics { gap: 5px; padding: 10px; }
	.ath-typing-speed__metrics span + span,
	.ath-typing-speed__resultMetrics span + span { padding-left: 6px; }
	.ath-typing-speed__toolbar { align-items: start; justify-items: start; }
	.ath-typing-speed__toolbar > span { max-width: none; }
	.ath-typing-speed__sound { width: fit-content; }
	.ath-typing-speed__actions { align-items: stretch; flex-direction: column; }
	.ath-typing-speed__button { width: 100%; }
	.ath-typing-speed__resultMetrics { gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
	.ath-typing-speed *,
	.ath-typing-speed *::before,
	.ath-typing-speed *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* The Bricks landing section owns the atmosphere so it can run edge to edge. */
.gc-typing-speed-section {
	background:
		radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--ctl-c3) 22%, transparent), transparent 34%),
		radial-gradient(circle at 96% 100%, color-mix(in srgb, var(--ctl-c2) 25%, transparent), transparent 38%),
		linear-gradient(116deg, color-mix(in srgb, var(--ctl-c3) 13%, var(--surface-1)), color-mix(in srgb, var(--surface-1) 94%, var(--ctl-c1) 6%) 42%, color-mix(in srgb, var(--ctl-c2) 19%, var(--surface-2)) 100%) !important;
}

.gc-typing-speed-section .ath-typing-speed {
	background: transparent;
	border-block-color: transparent;
}
