/* Practice hub and sessions. Sessions reuse the lesson player's exercise
   styles (player.css is loaded before this file). */

/* ---- Hub ---- */

.clh-practice-head {
	margin: 8px 0 22px;
}

.clh-practice-title {
	margin: 4px 0 6px;
	font-size: 1.9rem;
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.15;
}

.clh-practice-sub {
	margin: 0;
	color: var(--clh-text-muted);
}

.clh-activity {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 4px 16px;
	align-items: start;
	margin-bottom: 16px;
}

.clh-activity-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 14px;
	background: var(--clh-sunken);
	color: var(--clh-text-muted);
	font-size: 1.6rem;
}

.clh-activity.is-ready .clh-activity-icon {
	background: var(--clh-gold-soft);
	color: var(--clh-warm);
}

.clh-activity-title {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 800;
	line-height: 1.3;
}

.clh-activity-status {
	margin: 2px 0 0;
	font-weight: 700;
	color: var(--clh-text-muted);
}

.clh-activity.is-ready .clh-activity-status {
	color: var(--clh-warm);
}

.clh-activity-note {
	margin: 4px 0 0;
	font-size: 0.92rem;
	color: var(--clh-text-muted);
}

.clh-activity-go {
	grid-column: 1 / -1;
	margin-top: 14px;
}

@media (min-width: 600px) {
	.clh-activity {
		grid-template-columns: auto minmax(0, 1fr) auto;
		align-items: center;
	}

	.clh-activity-go {
		grid-column: auto;
		margin-top: 0;
	}
}

.clh-practice-back {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	margin-top: 4px;
	font-weight: 700;
	color: var(--clh-accent-text);
}

/* ---- Session ---- */

.clh-review-tag {
	margin-bottom: 10px;
	font-size: 0.76rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--clh-text-muted);
}

.clh-review-tag.is-new {
	color: var(--clh-warm);
}

.clh-review-word {
	display: flex;
	align-items: center;
	gap: 14px;
}

.clh-review-prompt .clh-review-zh {
	font-family: var(--clh-font-cn);
	font-size: 3rem;
	font-weight: 600;
	line-height: 1.15;
}

.clh-review-prompt .clh-py {
	display: block;
	margin-top: 2px;
	font-size: 1.05rem;
}

.clh-review-en {
	font-size: 1.45rem;
}

.clh-review-answer {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 2px 10px;
}

.clh-review-answer .clh-zh {
	font-family: var(--clh-font-cn);
	font-size: 1.3rem;
	font-weight: 700;
}

.clh-review-next:empty {
	display: none;
}

.clh-review-next {
	font-size: 0.92rem;
	color: var(--clh-text-muted);
}

/* Answered: the options no longer react. */
.clh-review-card .clh-option[aria-disabled='true'] {
	cursor: default;
}

.clh-review-card .clh-option:disabled {
	opacity: 0.55;
}

/* ---- Typing practice ---- */

.clh-typing-pos {
	margin: 2px 0 0;
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--clh-text-muted);
}

.clh-typing-reading {
	margin-top: 10px;
}

.clh-typing-input.is-correct {
	border-color: var(--clh-green);
	background: var(--clh-green-soft);
}

.clh-typing-candidates {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
	gap: 10px;
	margin-top: 16px;
}

/* Same look as .clh-option (player.css), with the characters centred. */
.clh-typing-candidate {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 64px;
	padding: 14px 10px 10px;
	border: 2px solid var(--clh-control-border);
	box-shadow: 0 3px 0 var(--clh-control-border);
	border-radius: 14px;
	background: var(--clh-raised);
	color: var(--clh-text);
	font-family: inherit;
	cursor: pointer;
	transition: transform 0.06s ease, box-shadow 0.06s ease, border-color 0.12s ease, background 0.12s ease;
}

.clh-typing-candidate:hover:not(.is-wrong):not(:disabled) {
	border-color: var(--clh-select);
	box-shadow: 0 3px 0 var(--clh-select);
}

.clh-typing-candidate:active:not(.is-wrong):not(:disabled) {
	transform: translateY(3px);
	box-shadow: none;
}

.clh-typing-candidate.is-correct {
	border-color: var(--clh-green);
	box-shadow: 0 3px 0 var(--clh-green);
	background: var(--clh-green-soft);
}

/* A wrong candidate is marked and taken out of play: struck through, its
   badge shows a cross, and it is disabled. */
.clh-typing-candidate.is-wrong {
	border-color: var(--clh-wrong);
	box-shadow: none;
	background: var(--clh-wrong-soft);
	cursor: not-allowed;
}

.clh-typing-candidate.is-wrong .clh-typing-candidate-zh {
	text-decoration: line-through;
	text-decoration-thickness: 2px;
	opacity: 0.75;
}

.clh-typing-candidate:disabled {
	cursor: default;
}

.clh-typing-candidate:disabled:not(.is-correct):not(.is-wrong) {
	opacity: 0.55;
}

.clh-typing-candidate-key {
	position: absolute;
	top: 6px;
	left: 8px;
	font-size: 0.72rem;
	font-weight: 800;
	color: var(--clh-text-muted);
}

.clh-typing-candidate.is-correct .clh-typing-candidate-key {
	color: var(--clh-green);
}

.clh-typing-candidate.is-wrong .clh-typing-candidate-key {
	color: var(--clh-wrong);
}

.clh-typing-candidate-zh {
	font-size: calc(1.6rem * var(--clh-zh-scale, 1));
	line-height: 1.15;
}

/* ---- Tone practice ---- */

.clh-tones-row {
	margin-top: 14px;
}

.clh-tones-row-label {
	margin-bottom: 6px;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--clh-text-muted);
}

/* Five tone buttons stay on one row even on a 360px phone. */
.clh-tones-card .clh-tone-options {
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 6px;
}

.clh-tones-card .clh-tone-option {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	min-height: 64px;
	padding: 6px 4px;
}

.clh-tones-option-name {
	font-size: 0.75rem;
	color: var(--clh-text-muted);
}

.clh-tones-answer {
	justify-content: center;
	margin-top: 16px;
	text-align: center;
}

.clh-tones-sandhi {
	margin-top: 8px;
	font-size: 0.92rem;
	color: var(--clh-text-muted);
}

.clh-tones-stats {
	margin: 20px 0 18px;
	text-align: left;
}

.clh-tones-stats-title {
	margin: 0 0 10px;
	font-size: 1.05rem;
}

.clh-tones-stat {
	display: grid;
	grid-template-columns: 4.5rem 1fr auto;
	gap: 10px;
	align-items: center;
	min-height: 32px;
}

/* The trickiest tone gains a fourth column for its flag. */
.clh-tones-stat.is-weakest {
	grid-template-columns: 4.5rem 1fr auto auto;
}

.clh-tones-stat-name {
	font-size: 0.9rem;
	font-weight: 600;
}

.clh-tones-stat-bar {
	display: block;
	height: 10px;
	border-radius: 999px;
	background: var(--clh-sunken);
	overflow: hidden;
}

.clh-tones-stat-fill {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: var(--clh-green);
}

.is-weakest .clh-tones-stat-fill {
	background: var(--clh-gold);
}

.clh-tones-stat-value {
	font-size: 0.9rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

/* Gold means "waiting" elsewhere in practice; here the text says why. */
.clh-tones-stat-flag {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--clh-gold-soft);
	color: var(--clh-warm);
	font-size: 0.72rem;
	font-weight: 800;
	white-space: nowrap;
}

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

.clh-speaking-lesson {
	margin-bottom: 4px;
	font-size: 0.8rem;
	color: var(--clh-text-muted);
}

.clh-speaking-sentence {
	margin: 12px 0;
	text-align: center;
}

.clh-speaking-zh {
	font-family: var(--clh-font-cn);
	font-size: calc(1.7rem * var(--clh-zh-scale, 1));
	font-weight: 500;
	line-height: 1.5;
	overflow-wrap: anywhere;
}

.clh-speaking-sentence .clh-py {
	display: block;
	margin-top: 2px;
}

/* Character marks: colour plus a shape or a line, never colour alone. */
.clh-speaking-char.is-good {
	color: var(--clh-green);
}

.clh-speaking-char.is-fair {
	text-decoration-line: underline;
	text-decoration-style: dotted;
	text-decoration-color: var(--clh-gold);
	text-decoration-thickness: 2px;
	text-underline-offset: 6px;
}

.clh-speaking-char.is-weak {
	color: var(--clh-red, var(--clh-wrong));
	text-decoration-line: underline;
	text-decoration-style: wavy;
	text-decoration-color: var(--clh-red, var(--clh-wrong));
	text-decoration-thickness: 2px;
	text-underline-offset: 6px;
}

.clh-speaking-char.is-missed {
	color: var(--clh-text-muted);
	text-decoration-line: line-through;
	text-decoration-thickness: 2px;
}

.clh-speaking-recorder {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	margin-top: 16px;
}

.clh-speaking-record {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 60px;
	min-width: 160px;
	padding: 12px 28px;
	border: 2px solid var(--clh-accent);
	border-radius: 999px;
	box-shadow: 0 4px 0 var(--clh-accent-strong);
	background: var(--clh-accent);
	color: #fff;
	font-family: inherit;
	font-size: 1.05rem;
	font-weight: 800;
	cursor: pointer;
	transition: transform 0.06s ease, box-shadow 0.06s ease, background 0.12s ease;
}

.clh-speaking-record .clh-icon {
	font-size: 1.25rem;
}

.clh-speaking-record:hover:not(:disabled) {
	filter: brightness(1.06);
}

.clh-speaking-record:active:not(:disabled) {
	transform: translateY(4px);
	box-shadow: none;
}

.clh-speaking-record:disabled {
	background: var(--clh-disabled-bg);
	border-color: var(--clh-disabled-bg);
	box-shadow: none;
	color: var(--clh-disabled-text);
	cursor: not-allowed;
}

.clh-speaking-record.is-recording {
	animation: clh-speaking-ring 1.4s ease-out infinite;
}

@keyframes clh-speaking-ring {
	0% {
		box-shadow: 0 4px 0 var(--clh-accent-strong), 0 0 0 0 color-mix(in srgb, var(--clh-accent) 45%, transparent);
	}
	70% {
		box-shadow: 0 4px 0 var(--clh-accent-strong), 0 0 0 12px color-mix(in srgb, var(--clh-accent) 0%, transparent);
	}
	100% {
		box-shadow: 0 4px 0 var(--clh-accent-strong), 0 0 0 0 color-mix(in srgb, var(--clh-accent) 0%, transparent);
	}
}

.clh-speaking-timer {
	font-variant-numeric: tabular-nums;
}

.clh-speaking-privacy,
.clh-speaking-status,
.clh-speaking-note {
	margin: 0;
	font-size: 0.85rem;
	color: var(--clh-text-muted);
	text-align: center;
}

.clh-speaking-status:empty {
	display: none;
}

.clh-speaking-error,
.clh-speaking-nomic {
	margin: 8px 0 0;
	padding: 10px 14px;
	border-radius: var(--clh-radius-sm);
	background: var(--clh-wrong-soft);
	color: var(--clh-wrong);
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.4;
}

.clh-speaking-result {
	margin-top: 16px;
}

.clh-speaking-compare {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
}

.clh-speaking-compare-label {
	font-weight: 600;
}

.clh-speaking-score {
	margin-top: 14px;
	text-align: center;
}

.clh-speaking-score-value {
	display: block;
	font-size: 2.4rem;
	font-weight: 800;
	line-height: 1.1;
}

.clh-speaking-score.is-pass .clh-speaking-score-value {
	color: var(--clh-green);
}

.clh-speaking-score.is-low .clh-speaking-score-value {
	color: var(--clh-gold);
}

.clh-speaking-score-word {
	display: block;
	font-weight: 700;
}

.clh-speaking-parts,
.clh-speaking-legend {
	margin: 6px 0 0;
	font-size: 0.85rem;
	color: var(--clh-text-muted);
}

.clh-speaking-legend {
	margin-top: 10px;
}

.clh-speaking-self {
	margin-top: 12px;
	text-align: center;
}

.clh-speaking-self > p {
	margin: 0 0 10px;
	font-size: 0.9rem;
	color: var(--clh-text-muted);
}

.clh-speaking-self-buttons {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
}

.clh-speaking-self-buttons .clh-btn {
	flex: 1 1 auto;
	min-height: 44px;
}

.clh-speaking-self-buttons .clh-btn + .clh-btn {
	margin-top: 0;
}

.clh-speaking-self-buttons .clh-btn.is-selected {
	border-color: var(--clh-select);
	box-shadow: 0 3px 0 var(--clh-select);
	background: var(--clh-select-soft);
	color: var(--clh-text);
}

.clh-speaking-skip {
	background: transparent;
}

/* .clh-btn sets display, which would override the UA rule for [hidden]. */
.clh-speaking-skip[hidden] {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.clh-speaking-record.is-recording {
		animation: none;
	}
}
