/* Chinese Learning Hub — learner dashboard (page /learn/). */

/* ---- Layout ----
   Phone: one column; the wrappers dissolve and `order` puts today's numbers
   straight under the next lesson. Desktop: path on the left, numbers in a
   sticky side rail. */

.clh-dash {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.clh-dash-main,
.clh-dash-side {
	display: contents;
}

.clh-sync-card { order: 0; }
.clh-hero { order: 1; }
.clh-today { order: 2; }
.clh-practice-card { order: 3; }
.clh-units { order: 4; }
.clh-rank { order: 5; }
.clh-level { order: 6; }
.clh-stats { order: 7; }
.clh-levels-list { order: 8; }
.clh-settings { order: 9; }

@media (min-width: 960px) {
	.clh-dash {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 340px;
		gap: 24px;
		align-items: start;
	}

	.clh-dash-main,
	.clh-dash-side {
		display: flex;
		flex-direction: column;
		gap: 16px;
		min-width: 0;
	}

	.clh-dash-side {
		position: sticky;
		top: calc(var(--clh-sticky-top, 0px) + 20px);
	}
}

/* ---- Streak milestone banner ---- */

.clh-streak-banner {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	border-radius: var(--clh-radius);
	background: var(--clh-gold-soft);
	color: var(--clh-text);
	font-weight: 700;
	margin-bottom: 16px;
}

.clh-streak-banner-icon {
	color: var(--clh-gold);
	font-size: 1.5rem;
}

/* ---- Next lesson ----
   The one loud block on the page: the brand colour, the lesson, one button. */

.clh-hero {
	position: relative;
	overflow: hidden;
	padding: 28px 24px 30px;
	border-radius: 24px;
	background: linear-gradient(135deg, var(--clh-accent) 0%, var(--clh-accent-strong) 100%);
	color: #fff;
}

/* An oversized character as a watermark. */
.clh-hero::after {
	content: '學';
	position: absolute;
	right: -18px;
	bottom: -56px;
	font-family: var(--clh-font-cn);
	font-size: 13rem;
	font-weight: 700;
	line-height: 1;
	color: rgba(255, 255, 255, 0.09);
	pointer-events: none;
}

.clh-hero > * {
	position: relative;
	z-index: 1;
}

.clh-hero-kicker {
	font-size: 0.76rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.85);
	margin-bottom: 8px;
}

.clh-app .clh-hero-title {
	font-size: 2rem;
	line-height: 1.1;
	margin: 0 0 4px;
	color: #fff;
}

.clh-hero-unit {
	color: rgba(255, 255, 255, 0.88);
	margin: 0 0 16px;
}

.clh-hero-dots {
	display: flex;
	gap: 6px;
	margin-bottom: 20px;
}

.clh-hero-dot {
	width: 28px;
	height: 8px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.28);
}

.clh-hero-dot.is-done {
	background: #fff;
}

.clh-hero-dot.is-current {
	background: var(--clh-gold);
}

.clh-hero-cta {
	min-width: 220px;
	min-height: 56px;
	font-size: 1.1rem;
	font-weight: 800;
	background: #fff;
	border-color: #fff;
	box-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
	color: #c8102e;
}

.clh-hero-cta:hover {
	color: #c8102e;
}

.clh-hero-cta:active {
	transform: translateY(4px);
}

/* ---- Today: goal ring, streak, week ---- */

.clh-today-top {
	display: flex;
	align-items: center;
	gap: 16px;
}

.clh-ring {
	position: relative;
	flex: none;
}

.clh-ring-track {
	stroke: var(--clh-sunken);
}

.clh-ring-fill {
	stroke: var(--clh-gold);
	transition: stroke-dashoffset 0.6s ease;
}

.clh-ring.is-reached .clh-ring-fill {
	stroke: var(--clh-progress);
}

.clh-ring-middle {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.clh-ring-value {
	font-size: 1.5rem;
	font-weight: 800;
	letter-spacing: -0.02em;
}

.clh-ring-unit {
	font-size: 0.7rem;
	font-weight: 800;
	color: var(--clh-warm);
	margin-top: 2px;
}

.clh-today-title {
	font-size: 1.15rem;
	margin: 0 0 2px;
}

.clh-today-note {
	margin: 0;
	color: var(--clh-text-muted);
	font-weight: 600;
	font-size: 0.95rem;
}

.clh-today-note.is-reached {
	color: var(--clh-green);
}

.clh-today-streak {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px 8px;
	margin-top: 16px;
	padding: 10px 14px;
	border-radius: var(--clh-radius-sm);
	background: var(--clh-sunken);
}

.clh-today-streak.is-lit {
	background: var(--clh-gold-soft);
}

.clh-today-flame {
	font-size: 1.5rem;
	color: var(--clh-text-muted);
}

.clh-today-streak.is-lit .clh-today-flame {
	color: var(--clh-gold);
}

.clh-today-streak-value {
	font-weight: 800;
}

.clh-today-streak-hint {
	flex-basis: 100%;
	font-size: 0.85rem;
	color: var(--clh-text-muted);
}

.clh-week {
	list-style: none;
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
	margin: 14px 0 0;
	padding: 0;
}

.clh-week-day {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
}

.clh-week-dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--clh-sunken);
	color: #fff;
	font-size: 0.9rem;
}

.clh-week-day.is-some .clh-week-dot {
	background: var(--clh-gold-soft);
	box-shadow: inset 0 0 0 2px var(--clh-gold);
}

.clh-week-day.is-done .clh-week-dot {
	background: var(--clh-gold);
}

.clh-week-day.is-today .clh-week-dot {
	outline: 2px solid var(--clh-text);
	outline-offset: 2px;
}

.clh-week-label {
	font-size: 0.72rem;
	font-weight: 800;
	color: var(--clh-text-muted);
}

.clh-week-day.is-today .clh-week-label {
	color: var(--clh-text);
}

/* ---- Totals ---- */

.clh-stats {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.clh-stat {
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.clh-stat-value {
	font-size: 1.4rem;
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.02em;
}

.clh-stat.is-xp .clh-stat-value {
	color: var(--clh-warm);
}

.clh-stat-label {
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--clh-text-muted);
}

/* Link to the stats page, under the two totals. */
.clh-stats-more {
	grid-column: 1 / -1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 44px;
	border-radius: var(--clh-radius-sm);
	font-size: 0.92rem;
	font-weight: 700;
	color: var(--clh-accent-text);
	text-decoration: none;
}

.clh-stats-more:hover {
	background: var(--clh-accent-soft);
}

.clh-stats-more svg {
	width: 1.1em;
	height: 1.1em;
}

/* ---- Current level ---- */

.clh-level-head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 14px;
}

.clh-level-label {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 52px;
	height: 44px;
	padding: 0 10px;
	border-radius: 13px;
	background: var(--clh-accent);
	color: #fff;
	font-size: 1.3rem;
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1;
}

.clh-level-headtext {
	flex: 1;
	min-width: 0;
}

.clh-level-title {
	font-size: 1.05rem;
	margin: 0;
}

.clh-level-hsk {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--clh-text-muted);
}

.clh-level-pct {
	font-size: 1.3rem;
	font-weight: 800;
	color: var(--clh-green);
}

.clh-level-desc {
	color: var(--clh-text-muted);
	margin: 12px 0 0;
	font-size: 0.9rem;
}

/* ---- Path ---- */

.clh-units-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin: 8px 2px 12px;
}

.clh-units-title {
	font-size: 1.4rem;
	margin: 0;
}

.clh-units-all {
	font-weight: 700;
	font-size: 0.95rem;
	color: var(--clh-accent-text);
}

.clh-units-empty {
	color: var(--clh-text-muted);
	margin: 0;
}

/* ---- All levels ---- */

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

.clh-level-chip {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 40px;
	padding: 4px 6px;
	margin: 0 -6px;
	border-radius: 10px;
	text-decoration: none;
	color: var(--clh-text);
}

.clh-level-chip:hover {
	background: var(--clh-sunken);
}

.clh-level-chip-label {
	width: 30px;
	font-weight: 800;
}

.clh-level-chip.is-current .clh-level-chip-label {
	color: var(--clh-accent-text);
}

.clh-level-chip-track {
	display: block;
	flex: 1;
	height: 8px;
	border-radius: 999px;
	background: var(--clh-sunken);
	overflow: hidden;
}

.clh-level-chip-fill {
	display: block;
	height: 100%;
	background: var(--clh-progress);
	border-radius: 999px;
}

/* Link to the certificates, under the level list. Gold once one is earned. */
.clh-levels-certs {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 48px;
	margin: 10px -6px -6px;
	padding: 6px;
	border-top: 1px solid var(--clh-border);
	border-radius: 0 0 10px 10px;
	font-size: 0.92rem;
	font-weight: 700;
	color: var(--clh-text);
	text-decoration: none;
}

.clh-levels-certs:hover {
	background: var(--clh-sunken);
}

.clh-levels-certs-icon {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 9px;
	background: var(--clh-sunken);
	color: var(--clh-text-muted);
	font-size: 1rem;
}

.clh-levels-certs.is-earned .clh-levels-certs-icon {
	background: var(--clh-gold-soft);
	color: var(--clh-warm);
}

.clh-levels-certs-text {
	flex: 1;
	min-width: 0;
}

.clh-levels-certs-arrow {
	display: inline-flex;
	flex: none;
	color: var(--clh-text-muted);
}

.clh-level-chip-pct {
	width: 44px;
	text-align: right;
	font-size: 0.82rem;
	font-weight: 700;
	color: var(--clh-text-muted);
}

.clh-level-chip.is-empty {
	color: var(--clh-text-muted);
}

/* ---- Settings ---- */

.clh-settings {
	padding: 0;
}

.clh-settings-summary {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 20px;
	cursor: pointer;
	list-style: none;
}

.clh-settings-summary::-webkit-details-marker {
	display: none;
}

.clh-settings-icon {
	color: var(--clh-text-muted);
}

.clh-settings-summary > span {
	font-weight: 700;
}

.clh-settings-chevron {
	color: var(--clh-text-muted);
	transition: transform 0.2s ease;
	margin-left: auto;
}

.clh-settings[open] .clh-settings-chevron {
	transform: rotate(180deg);
}

.clh-settings-body {
	padding: 16px 20px 20px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	border-top: 1px solid var(--clh-border);
}

.clh-setting-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.clh-setting-label {
	font-weight: 700;
	font-size: 0.95rem;
}

.clh-goal-options {
	display: inline-flex;
	padding: 3px;
	border-radius: 999px;
	background: var(--clh-sunken);
}

.clh-goal-option {
	min-height: 38px;
	min-width: 48px;
	border: none;
	border-radius: 999px;
	background: transparent;
	color: var(--clh-text-muted);
	font-weight: 700;
	cursor: pointer;
}

.clh-goal-option.is-active {
	background: var(--clh-card-bg);
	color: var(--clh-text);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
}

@media (min-width: 600px) {
	.clh-hero {
		padding: 36px 36px 38px;
	}

	.clh-app .clh-hero-title {
		font-size: 2.4rem;
	}
}

/* ---- Practice card ---- */

.clh-practice-card {
	padding-bottom: 12px;
}

.clh-practice-card-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 6px;
}

.clh-practice-card-title {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 800;
}

.clh-practice-card-all {
	font-size: 0.88rem;
	font-weight: 700;
	color: var(--clh-accent-text);
}

.clh-practice-row {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 52px;
	padding: 6px 0;
	border-top: 1px solid var(--clh-border);
	color: var(--clh-text);
	font-weight: 600;
	text-decoration: none;
}

.clh-practice-row:hover {
	color: var(--clh-text);
}

.clh-practice-row-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 10px;
	background: var(--clh-sunken);
	color: var(--clh-text-muted);
	font-size: 1.2rem;
	flex: none;
}

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

.clh-practice-row-label {
	flex: 1;
	min-width: 0;
}

.clh-practice-row-count {
	flex: none;
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--clh-text-muted);
}

.clh-practice-row.is-ready .clh-practice-row-count {
	min-width: 30px;
	padding: 3px 10px;
	border-radius: 999px;
	background: var(--clh-gold);
	color: #4a3200;
	font-weight: 800;
	text-align: center;
}

/* Four digits or more still fit inside the ring. */
.clh-ring-value.is-long {
	font-size: 1.05rem;
}

/* ---- Story card ----
   Directly after the practice card, and in the same place in the phone's
   single column. */

.clh-dash-story {
	order: 3;
	padding-bottom: 18px;
}

.clh-dash-story-zh {
	margin: 4px 0 0;
	font-family: var(--clh-font-cn);
	font-size: calc(1.35rem * var(--clh-zh-scale, 1));
	font-weight: 700;
	line-height: 1.3;
}

.clh-dash-story-en {
	font-weight: 700;
}

.clh-dash-story-meta {
	margin: 2px 0 12px;
	font-size: 0.85rem;
	color: var(--clh-text-muted);
}

.clh-dash-story .clh-btn {
	width: 100%;
}

/* ---- XP milestone card ---- */

.clh-rank-head {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-bottom: 14px;
}

.clh-rank-title {
	margin: 2px 0 0;
	font-size: 1.2rem;
	font-weight: 800;
	line-height: 1.25;
}

.clh-rank-sub {
	font-size: 0.9rem;
	color: var(--clh-text-muted);
}

.clh-rank-ladder {
	margin-top: 12px;
	border-top: 1px solid var(--clh-border);
}

.clh-rank-ladder-summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 44px;
	font-size: 0.9rem;
	font-weight: 700;
	cursor: pointer;
	list-style: none;
}

.clh-rank-ladder-summary::-webkit-details-marker {
	display: none;
}

.clh-rank-ladder[open] .clh-rank-ladder-chevron {
	transform: rotate(180deg);
}

.clh-rank-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.clh-rank-item {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 10px 0;
	border-top: 1px solid var(--clh-border);
}

.clh-rank-item-text {
	flex: 1;
	min-width: 0;
	font-size: 0.92rem;
	line-height: 1.4;
}

.clh-rank-item-name {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 8px;
	font-weight: 700;
}

.clh-rank-item-note {
	color: var(--clh-text-muted);
	font-size: 0.85rem;
}

.clh-rank-item-xp {
	flex: none;
	font-size: 0.8rem;
	font-weight: 800;
	color: var(--clh-text-muted);
	white-space: nowrap;
}

.clh-rank-item.is-reached .clh-rank-item-xp {
	color: var(--clh-warm);
}

.clh-rank-item.is-current .clh-rank-item-name {
	color: var(--clh-accent-text);
}

/* ---- Waiting to sync (lessons done offline) ---- */

.clh-sync-card {
	border: 2px solid var(--clh-gold);
}

.clh-sync-title {
	margin: 0 0 4px;
	font-size: 1.1rem;
}

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

.clh-sync-next {
	margin-top: 14px;
}

/* ---- Install as an app (settings) ---- */

.clh-install {
	min-width: 0;
	text-align: right;
}

.clh-install-hint {
	font-size: 0.84rem;
	line-height: 1.35;
	color: var(--clh-text-muted);
}

.clh-install-btn {
	min-height: 44px;
	padding: 0 18px;
	border: 2px solid var(--clh-control-border);
	border-radius: 999px;
	background: var(--clh-raised);
	color: var(--clh-text);
	font-size: 0.92rem;
	font-weight: 700;
	cursor: pointer;
}

.clh-install-btn:hover {
	border-color: var(--clh-text-muted);
}

/* The language picker: a native select (keyboard and screen readers for free), dressed as a pill
   like the other settings controls, with its own chevron so it follows the light and dark themes. */
.clh-select {
	position: relative;
	display: inline-flex;
}

.clh-select select {
	appearance: none;
	-webkit-appearance: none;
	min-height: 44px;
	padding: 0 40px 0 18px;
	border: none;
	border-radius: 999px;
	background: var(--clh-sunken);
	color: var(--clh-text);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.clh-select select:focus-visible,
.clh-account-logout:focus-visible {
	outline: 2px solid var(--clh-accent);
	outline-offset: 2px;
}

.clh-select::after {
	content: '';
	position: absolute;
	right: 18px;
	top: 50%;
	width: 7px;
	height: 7px;
	border-right: 2px solid var(--clh-text-muted);
	border-bottom: 2px solid var(--clh-text-muted);
	transform: translateY(-70%) rotate(45deg);
	pointer-events: none;
}

.clh-select select option {
	background: var(--clh-card-bg);
	color: var(--clh-text);
}

.clh-account-row {
	padding-top: 14px;
	border-top: 1px solid var(--clh-border);
}

.clh-account-name {
	color: var(--clh-text-muted);
	font-size: 0.9rem;
	overflow-wrap: anywhere;
}

.clh-account-logout {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 18px;
	border-radius: 999px;
	background: var(--clh-sunken);
	color: var(--clh-text);
	font-weight: 700;
	text-decoration: none;
	white-space: nowrap;
}

.clh-account-logout:hover {
	color: var(--clh-accent-text, var(--clh-accent));
}
