/*
 * SeguroAprendo — advisor webapp.
 *
 * Written mobile-first: the base rules describe a 360px phone and the media
 * queries add room, never take it away.
 *
 * Colour never appears literally here. Every value comes from a `--c-*` design
 * token emitted by the theme engine, so the seasonal preset and the
 * promotoría's brand colours repaint the whole interface without touching CSS.
 * The component-level aliases in the first block are the only place a name is
 * bound to a token.
 *
 * Everything is scoped under `.ale` / `.ale-*`: no bare element selectors, so
 * the plugin cannot leak styles into the theme, Gutenberg, Elementor or
 * wp-admin.
 *
 * Accessibility floor: state is never carried by colour alone, focus is always
 * visible, touch targets stay at 44px, and motion respects
 * prefers-reduced-motion.
 */

.ale {
	/* ---------------------------- colour ----------------------------- */
	--ink: var(--c-text);
	--ink-soft: var(--c-text-muted);
	--paper: var(--c-bg);
	--surface: var(--c-surface);
	--rule: var(--c-border);
	--rule-strong: var(--c-border-strong);
	--brass: var(--c-accent);
	--brass-deep: var(--c-accent);
	--brass-soft: var(--c-accent-soft);
	--verify: var(--c-success);
	--verify-soft: var(--c-success-soft);
	--flag: var(--c-danger);
	--flag-soft: var(--c-danger-soft);
	--primary: var(--c-primary);
	--primary-hover: var(--c-primary-hover);
	--primary-soft: var(--c-primary-soft);
	--secondary: var(--c-secondary);
	--on-primary: var(--c-surface);

	/* ---------------------------- spacing ---------------------------- */
	--s1: 4px;
	--s2: 8px;
	--s3: 12px;
	--s4: 16px;
	--s5: 20px;
	--s6: 24px;
	--s8: 32px;

	--gutter: 16px;
	--gap: var(--s4);

	/* ----------------------------- shape ----------------------------- */
	--r-hero: 24px;
	--r-lg: 20px;
	--r-md: 16px;
	--r-sm: 12px;
	--r-pill: 999px;
	--radius: var(--r-md);
	--radius-sm: var(--r-sm);

	--tap: 44px;
	--tap-lg: 52px;
	--node: 52px;

	/* Discreet elevation: surface contrast first, shadow second. */
	--shadow-sm: 0 1px 2px rgba(23, 32, 51, 0.05);
	--shadow: 0 1px 2px rgba(23, 32, 51, 0.05), 0 6px 20px rgba(23, 32, 51, 0.06);
	--shadow-lift: 0 2px 4px rgba(23, 32, 51, 0.08), 0 12px 28px rgba(23, 32, 51, 0.10);

	/* --------------------------- typography -------------------------- */
	--font-body: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--font-doc: Manrope, Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
	--font-code: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

	--t-hero: 1.5rem;
	--t-screen: 1.3rem;
	--t-section: 1.05rem;
	--t-body: 0.94rem;
	--t-small: 0.82rem;
	--t-caption: 0.72rem;

	--ease: cubic-bezier(0.2, 0.7, 0.3, 1);

	background: var(--paper);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 16px;
	max-width: 100vw;
	line-height: 1.5;
	min-height: 100vh;
	overflow-x: hidden;
	padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
	position: relative;
	-webkit-font-smoothing: antialiased;
}

.ale *,
.ale *::before,
.ale *::after {
	box-sizing: border-box;
}

/*
 * Defensive reset against the promotoría's own theme.
 *
 * The plugin runs inside whatever theme each installation uses, and a theme
 * that declares `button, input, select, textarea { white-space: nowrap }` — a
 * common rule, meant for small UI buttons — turns every answer option into a
 * single unbreakable line. The option card then grows to the width of its
 * longest sentence (measured at 1,677px on a 390px screen) and the learner has
 * to drag the activity sideways to read the answers. `word-break: keep-all`
 * has the same effect. Our own controls carry full sentences, so they restate
 * their wrapping instead of inheriting it. Type-level selectors inside `.ale`
 * outrank a theme's bare element rules without leaking outside the app.
 */
.ale button,
.ale input,
.ale select,
.ale textarea,
.ale label,
.ale th,
.ale td {
	overflow-wrap: break-word;
	white-space: normal;
	word-break: normal;
}

/* A theme that lifts the media cap would let an SVG push the layout open. */
.ale img,
.ale svg,
.ale canvas {
	max-width: 100%;
}

.ale :focus-visible {
	outline: 3px solid var(--primary);
	outline-offset: 2px;
}

.ale button {
	font: inherit;
}

.ale h1,
.ale h2,
.ale h3 {
	font-family: var(--font-doc);
	letter-spacing: -0.01em;
	margin: 0;
}

.ale h1 {
	font-size: var(--t-screen);
	line-height: 1.25;
}

.ale h2 {
	font-size: var(--t-section);
	line-height: 1.3;
}

.ale-eyebrow {
	color: var(--ink-soft);
	font-size: var(--t-caption);
	font-weight: 600;
	letter-spacing: 0.08em;
	margin: 0 0 var(--s2);
	text-transform: uppercase;
}

.ale-lead {
	color: var(--ink-soft);
	font-size: var(--t-body);
	margin: 0 0 var(--s3);
}

.ale-sr {
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

/* ============================== SHELL ================================= */

.ale-app {
	display: block;
}

.ale-sidebar {
	display: none;
}

.ale-topbar {
	align-items: center;
	background: var(--surface);
	border-bottom: 1px solid var(--rule);
	display: flex;
	gap: var(--s3);
	justify-content: space-between;
	padding: var(--s3) var(--gutter);
	padding-top: calc(var(--s3) + env(safe-area-inset-top, 0px));
	position: sticky;
	top: 0;
	z-index: 30;
}

.ale-topbar__id {
	align-items: center;
	display: flex;
	gap: var(--s3);
	min-width: 0;
}

.ale-topbar__avatar svg {
	border-radius: 50%;
	display: block;
	height: 38px;
	width: 38px;
}

.ale-topbar__hello {
	display: block;
	font-family: var(--font-doc);
	font-size: var(--t-body);
	font-weight: 700;
	line-height: 1.2;
}

.ale-topbar__product {
	color: var(--ink-soft);
	display: block;
	font-size: var(--t-caption);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Streak and XP read as compact chips, not a table of statistics. */
.ale-stats {
	display: flex;
	gap: var(--s2);
	margin: 0;
}

.ale-stat {
	align-items: baseline;
	background: var(--c-bg-sunken);
	border-radius: var(--r-pill);
	display: flex;
	gap: 4px;
	padding: 5px 10px;
}

.ale-stat dt {
	color: var(--ink-soft);
	font-size: 0.62rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.ale-stat dd {
	font-family: var(--font-doc);
	font-size: var(--t-small);
	font-weight: 700;
	margin: 0;
}

.ale-main {
	margin: 0 auto;
	max-width: 640px;
	padding: var(--s5) var(--gutter) var(--s8);
}

.ale-main:focus {
	outline: none;
}

/* ============================== CARDS ================================= */

.ale-card {
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--r-lg);
	box-shadow: var(--shadow-sm);
	margin-bottom: var(--s3);
	padding: var(--s4);
}

.ale-card--action {
	border-color: var(--primary-soft);
}

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

.ale-hero {
	background: linear-gradient(140deg, var(--c-secondary) 0%, var(--c-primary) 100%);
	border-radius: var(--r-hero);
	box-shadow: var(--shadow);
	color: var(--on-primary);
	margin-bottom: var(--s3);
	overflow: hidden;
	padding: var(--s5);
	position: relative;
}

/* A soft light source instead of a decorative image: no extra request. */
.ale-hero::after {
	background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.22), transparent 65%);
	content: "";
	height: 180px;
	pointer-events: none;
	position: absolute;
	right: -40px;
	top: -60px;
	width: 180px;
}

.ale-hero__label {
	color: rgba(255, 255, 255, 0.82);
	font-size: var(--t-caption);
	font-weight: 700;
	letter-spacing: 0.1em;
	margin: 0 0 var(--s2);
	text-transform: uppercase;
}

.ale-hero__title {
	font-size: var(--t-hero);
	line-height: 1.2;
	margin: 0 0 var(--s2);
}

.ale-hero__text {
	color: rgba(255, 255, 255, 0.88);
	font-size: var(--t-small);
	margin: 0 0 var(--s4);
}

.ale-hero__row {
	align-items: center;
	display: flex;
	gap: var(--s4);
	position: relative;
}

.ale-hero__actions {
	display: grid;
	flex: 1 1 auto;
	gap: var(--s2);
}

.ale-hero .ale-btn {
	background: var(--surface);
	border-color: var(--surface);
	color: var(--c-primary);
}

.ale-hero .ale-btn--ghost {
	background: rgba(255, 255, 255, 0.14);
	border-color: rgba(255, 255, 255, 0.42);
	color: var(--on-primary);
}

/* --------------------------- progress ring ---------------------------- */

.ale-ring {
	align-items: center;
	background: conic-gradient(currentColor calc(var(--value) * 1%), rgba(255, 255, 255, 0.26) 0);
	border-radius: 50%;
	display: flex;
	flex: 0 0 auto;
	height: 78px;
	justify-content: center;
	position: relative;
	width: 78px;
}

.ale-ring::before {
	background: var(--c-secondary);
	border-radius: 50%;
	content: "";
	inset: 7px;
	position: absolute;
}

.ale-ring__value {
	font-family: var(--font-doc);
	font-size: 1.05rem;
	font-weight: 700;
	position: relative;
}

.ale-ring--plain {
	background: conic-gradient(var(--c-primary) calc(var(--value) * 1%), var(--c-bg-sunken) 0);
	color: var(--ink);
}

.ale-ring--plain::before {
	background: var(--surface);
}

/* ----------------------------- meters --------------------------------- */

.ale-meter {
	background: var(--c-border-soft);
	border-radius: var(--r-pill);
	height: 8px;
	margin: var(--s2) 0;
	overflow: hidden;
}

.ale-meter__fill {
	background: var(--primary);
	border-radius: var(--r-pill);
	display: block;
	height: 100%;
	transition: width 300ms var(--ease);
}

.ale-meter--slim {
	height: 6px;
	margin: 0;
}

/* ============================= MISSIONS =============================== */

.ale-section-head {
	align-items: baseline;
	display: flex;
	justify-content: space-between;
	margin: var(--s6) 0 var(--s3);
}

.ale-section-head h2 {
	font-size: var(--t-section);
}

.ale-section-head__meta {
	color: var(--ink-soft);
	font-size: var(--t-small);
	font-weight: 600;
}

.ale-missions {
	display: grid;
	gap: var(--s2);
	grid-template-columns: repeat(3, minmax(0, 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.ale-mission {
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--r-md);
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-height: 108px;
	padding: var(--s3);
}

.ale-mission--done {
	background: var(--verify-soft);
	border-color: var(--verify);
}

.ale-mission__icon {
	align-items: center;
	background: var(--primary-soft);
	border-radius: var(--r-sm);
	color: var(--primary);
	display: inline-flex;
	height: 28px;
	justify-content: center;
	width: 28px;
}

.ale-mission--done .ale-mission__icon {
	background: var(--verify);
	color: var(--surface);
}

.ale-mission__label {
	font-size: var(--t-caption);
	font-weight: 700;
	line-height: 1.25;
}

.ale-mission__state {
	color: var(--ink-soft);
	font-size: 0.66rem;
	margin-top: auto;
}

.ale-mission--done .ale-mission__state {
	color: var(--verify);
	font-weight: 700;
}

/* ========================= CONTINUE / LIST CARDS ====================== */

.ale-row {
	align-items: center;
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--r-lg);
	display: flex;
	gap: var(--s3);
	margin-bottom: var(--s2);
	min-height: 72px;
	padding: var(--s3);
	text-align: left;
	transition: transform 160ms var(--ease), box-shadow 160ms var(--ease);
	width: 100%;
}

.ale-row:hover {
	cursor: pointer;
}

.ale-row:active {
	box-shadow: none;
	transform: scale(0.99);
}

.ale-row--active {
	border-color: var(--primary);
	box-shadow: inset 3px 0 0 var(--primary);
}

.ale-row__badge {
	align-items: center;
	background: var(--primary-soft);
	border-radius: var(--r-sm);
	color: var(--primary);
	display: flex;
	flex: 0 0 44px;
	font-family: var(--font-doc);
	font-size: var(--t-small);
	font-weight: 700;
	height: 44px;
	justify-content: center;
}

.ale-row__body {
	flex: 1 1 auto;
	min-width: 0;
}

.ale-row__title {
	display: block;
	font-family: var(--font-doc);
	font-size: var(--t-body);
	font-weight: 700;
	line-height: 1.3;
}

.ale-row__meta {
	color: var(--ink-soft);
	display: block;
	font-size: var(--t-caption);
	margin-top: 2px;
}

.ale-row__go {
	color: var(--ink-soft);
	flex: 0 0 auto;
}

/* ============================ PATH / MAP ============================== */

.ale-metrics {
	display: grid;
	gap: var(--s2);
	grid-template-columns: repeat(3, minmax(0, 1fr));
	margin-bottom: var(--s5);
}

.ale-metric {
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--r-md);
	padding: var(--s3);
	text-align: center;
}

.ale-metric__value {
	display: block;
	font-family: var(--font-doc);
	font-size: 1.15rem;
	font-weight: 700;
	line-height: 1.1;
}

.ale-metric__label {
	color: var(--ink-soft);
	display: block;
	/*
	 * Three cards share the width, so at 360px each label gets 89px while
	 * "MICROLECCIONES" wants 100px at a fixed size: the word used to spill
	 * across the card's own border. The size now follows the viewport and the
	 * tracking tightens with it; `anywhere` is the last resort for a label
	 * longer than any of ours.
	 */
	font-size: clamp(0.56rem, 2.3vw, 0.64rem);
	letter-spacing: 0.04em;
	margin-top: 3px;
	overflow-wrap: anywhere;
	text-transform: uppercase;
}

/* Route card: heading of a section in the map. */
.ale-route {
	margin-bottom: var(--s6);
}

.ale-route__head {
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--r-lg);
	padding: var(--s4);
}

.ale-route--active .ale-route__head {
	border-color: var(--primary);
	box-shadow: var(--shadow-sm);
}

.ale-route__top {
	align-items: center;
	display: flex;
	gap: var(--s2);
	justify-content: space-between;
	margin-bottom: var(--s2);
}

.ale-route__id {
	color: var(--ink-soft);
	font-family: var(--font-doc);
	font-size: var(--t-caption);
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.ale-route__title {
	font-size: var(--t-section);
	margin-bottom: var(--s2);
}

.ale-chip {
	border-radius: var(--r-pill);
	font-size: 0.66rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	padding: 4px 10px;
	text-transform: uppercase;
	white-space: nowrap;
}

.ale-chip--active    { background: var(--primary-soft); color: var(--primary); }
.ale-chip--done      { background: var(--verify-soft);  color: var(--verify); }
.ale-chip--locked    { background: var(--c-bg-sunken);  color: var(--ink-soft); }
.ale-chip--optional  { background: var(--brass-soft);   color: var(--brass); }

.ale-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 var(--s3);
}

/* --------------------------- unit and nodes --------------------------- */

.ale-unit {
	margin-top: var(--s4);
	padding-left: var(--s3);
}

.ale-unit__tab {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: var(--s2);
	margin: 0 0 var(--s1);
}

.ale-unit__id {
	color: var(--ink-soft);
	font-family: var(--font-code);
	font-size: 0.66rem;
}

.ale-unit__title {
	font-family: var(--font-doc);
	font-size: var(--t-body);
	font-weight: 700;
	margin: 0 0 var(--s2);
}

/* The map: a single spine with nodes hanging off it. */
.ale-path {
	display: flex;
	flex-direction: column;
	list-style: none;
	margin: 0;
	padding: 0;
}

.ale-path__row {
	display: flex;
	position: relative;
}

.ale-path__row::before {
	background: var(--rule);
	content: "";
	left: calc(var(--node) / 2 - 1px);
	position: absolute;
	top: 0;
	width: 2px;
	height: 100%;
	z-index: 0;
}

.ale-path__row:first-child::before {
	top: 50%;
	height: 50%;
}

.ale-path__row:last-child::before {
	height: 50%;
}

.ale-path__row--done::before {
	background: var(--verify);
}

.ale-node {
	align-items: center;
	background: none;
	border: none;
	display: flex;
	gap: var(--s3);
	min-height: 60px;
	padding: var(--s1) 0;
	text-align: left;
	width: 100%;
	z-index: 1;
}

.ale-node:not([aria-disabled="true"]):hover {
	cursor: pointer;
}

.ale-node:not([aria-disabled="true"]):active .ale-node__dot {
	transform: scale(0.94);
}

.ale-node__dot {
	align-items: center;
	background: var(--surface);
	border: 2px solid var(--rule);
	border-radius: 50%;
	color: var(--ink-soft);
	display: flex;
	flex: 0 0 var(--node);
	font-family: var(--font-doc);
	font-size: var(--t-small);
	font-weight: 700;
	height: var(--node);
	justify-content: center;
	transition: transform 160ms var(--ease);
	width: var(--node);
}

.ale-node--available .ale-node__dot,
.ale-node--in_progress .ale-node__dot {
	border-color: var(--primary);
	color: var(--primary);
}

.ale-node--completed .ale-node__dot,
.ale-node--mastered .ale-node__dot {
	background: var(--verify);
	border-color: var(--verify);
	color: var(--surface);
}

.ale-node--current .ale-node__dot {
	background: var(--primary);
	border-color: var(--primary);
	box-shadow: 0 0 0 5px var(--primary-soft);
	color: var(--on-primary);
}

/* Challenges and assessments are a different shape, not just a colour. */
.ale-node--challenge .ale-node__dot,
.ale-node--checkpoint .ale-node__dot,
.ale-node--assessment .ale-node__dot {
	border-radius: var(--r-sm);
	transform: rotate(45deg);
}

.ale-node--challenge .ale-node__dot > *,
.ale-node--checkpoint .ale-node__dot > *,
.ale-node--assessment .ale-node__dot > * {
	transform: rotate(-45deg);
}

.ale-node__body {
	flex: 1 1 auto;
	min-width: 0;
}

.ale-node__label {
	display: block;
	font-size: var(--t-body);
	font-weight: 600;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.ale-node--locked .ale-node__label {
	color: var(--ink-soft);
}

.ale-node__caption {
	color: var(--ink-soft);
	display: block;
	font-size: var(--t-caption);
	margin-top: 2px;
}

.ale-node__marker {
	background: var(--primary);
	border-radius: var(--r-pill);
	color: var(--on-primary);
	font-size: 0.64rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	margin-left: auto;
	padding: 5px 11px;
	text-transform: uppercase;
	white-space: nowrap;
}

/* ============================== RUNNER ================================ */

.ale-runner {
	background: var(--paper, #f7f8fa);
	bottom: 0;
	display: flex;
	flex-direction: column;
	left: 0;
	position: fixed;
	right: 0;
	top: 0;
	z-index: 60;
}

.ale-runner__head {
	align-items: center;
	background: var(--surface);
	border-bottom: 1px solid var(--rule);
	display: flex;
	gap: var(--s3);
	padding: var(--s3) var(--gutter);
	padding-top: calc(var(--s3) + env(safe-area-inset-top, 0px));
}

.ale-runner__close {
	align-items: center;
	background: none;
	border: none;
	border-radius: 50%;
	color: var(--ink-soft);
	display: flex;
	font-size: 1.2rem;
	height: var(--tap);
	justify-content: center;
	width: var(--tap);
}

.ale-runner__close:hover {
	background: var(--c-bg-sunken);
	cursor: pointer;
}

.ale-runner__meter {
	background: var(--c-bg-sunken);
	border-radius: var(--r-pill);
	flex: 1 1 auto;
	height: 10px;
	overflow: hidden;
}

.ale-runner__meter span {
	background: var(--primary);
	border-radius: var(--r-pill);
	display: block;
	height: 100%;
	transition: width 260ms var(--ease);
}

.ale-runner__count {
	color: var(--ink-soft);
	font-size: var(--t-small);
	font-weight: 600;
	white-space: nowrap;
}

.ale-runner__body {
	flex: 1 1 auto;
	margin: 0 auto;
	max-width: 640px;
	overflow-y: auto;
	padding: var(--s5) var(--gutter) 220px;
	width: 100%;
}

.ale-stem {
	font-family: var(--font-doc);
	font-size: 1.1rem;
	font-weight: 600;
	line-height: 1.4;
	margin: 0 0 var(--s5);
	overflow-wrap: anywhere;
	white-space: pre-line;
}

/* ----------------------------- options -------------------------------- */

.ale-options {
	display: grid;
	gap: var(--s2);
}

.ale-option {
	align-items: center;
	background: var(--surface);
	border: 1.5px solid var(--rule);
	border-radius: 14px;
	display: flex;
	gap: var(--s3);
	min-height: var(--tap-lg);
	padding: var(--s3) var(--s4);
	text-align: left;
	transition: border-color 140ms var(--ease), background 140ms var(--ease), transform 140ms var(--ease);
	width: 100%;
}

.ale-option:hover {
	border-color: var(--rule-strong);
	cursor: pointer;
}

.ale-option:active {
	transform: scale(0.995);
}

.ale-option[aria-pressed="true"] {
	background: var(--primary-soft);
	border-color: var(--primary);
}

.ale-option__key {
	align-items: center;
	background: var(--c-bg-sunken);
	border-radius: var(--r-sm);
	display: flex;
	flex: 0 0 30px;
	font-family: var(--font-doc);
	font-size: var(--t-small);
	font-weight: 700;
	height: 30px;
	justify-content: center;
}

.ale-option[aria-pressed="true"] .ale-option__key {
	background: var(--primary);
	color: var(--on-primary);
}

.ale-option__text {
	font-size: var(--t-body);
	line-height: 1.35;
	/*
	 * A flex child defaults to min-width:auto, so a long unbroken string forces
	 * the card past the viewport and the whole page scrolls sideways. These two
	 * lines are what keep the layout inside the screen.
	 */
	min-width: 0;
	overflow-wrap: anywhere;
}

/* --------------------------- other inputs ----------------------------- */

.ale-ordering {
	display: grid;
	gap: var(--s2);
	list-style: none;
	margin: 0;
	padding: 0;
}

.ale-ordering li {
	align-items: center;
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: 14px;
	display: flex;
	gap: var(--s2);
	min-height: var(--tap-lg);
	padding: var(--s2) var(--s3);
}

.ale-ordering__rank {
	align-items: center;
	background: var(--c-bg-sunken);
	border-radius: var(--r-sm);
	display: flex;
	flex: 0 0 26px;
	font-size: var(--t-small);
	height: 26px;
	justify-content: center;
}

.ale-ordering__text {
	flex: 1 1 auto;
	font-size: var(--t-body);
	min-width: 0;
	overflow-wrap: anywhere;
}

.ale-ordering button {
	background: var(--c-bg-sunken);
	border: 1px solid var(--rule);
	border-radius: var(--r-sm);
	height: var(--tap);
	width: var(--tap);
}

.ale-ordering button:hover {
	cursor: pointer;
}

.ale-matching {
	border-collapse: separate;
	border-spacing: 0 var(--s2);
	width: 100%;
}

.ale-matching th,
.ale-matching td {
	padding: 0;
	text-align: left;
	vertical-align: middle;
}

.ale-matching th {
	font-size: var(--t-small);
	font-weight: 600;
	padding-bottom: var(--s1);
}

.ale-matching select,
.ale-input {
	background: var(--surface);
	border: 1.5px solid var(--rule);
	border-radius: 14px;
	font: inherit;
	min-height: var(--tap-lg);
	padding: var(--s3);
	width: 100%;
}

/* ============================== VERDICT =============================== */

.ale-verdict {
	background: var(--c-surface, #ffffff);
	border-top: 1px solid var(--rule);
	border-radius: var(--r-hero) var(--r-hero) 0 0;
	bottom: 0;
	box-shadow: var(--shadow-lift);
	left: 0;
	/*
	 * The correction is now three blocks and a citation, which on a short
	 * screen can be taller than the screen itself. The panel is capped and
	 * scrolls inside, so "Continuar" is always reachable instead of being
	 * pushed off the bottom.
	 */
	max-height: 85vh;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: var(--s4) var(--gutter);
	padding-bottom: calc(var(--s4) + env(safe-area-inset-bottom, 0px));
	position: fixed;
	right: 0;
	z-index: 70;
}

.ale-verdict__inner {
	margin: 0 auto;
	max-width: 640px;
}

.ale-verdict--correct {
	background: var(--verify-soft);
	border-top-color: var(--verify);
}

.ale-verdict--incorrect {
	background: var(--flag-soft);
	border-top-color: var(--flag);
}

.ale-verdict__title {
	align-items: center;
	display: flex;
	font-family: var(--font-doc);
	font-size: var(--t-small);
	font-weight: 700;
	gap: var(--s2);
	letter-spacing: 0.06em;
	margin: 0 0 var(--s2);
	text-transform: uppercase;
}

.ale-verdict--correct .ale-verdict__title { color: var(--verify); }
.ale-verdict--incorrect .ale-verdict__title { color: var(--flag); }

.ale-verdict__xp {
	background: var(--verify);
	border-radius: var(--r-pill);
	color: var(--surface);
	font-size: 0.66rem;
	margin-left: auto;
	padding: 3px 10px;
}

.ale-verdict__text {
	font-size: var(--t-body);
	margin: 0 0 var(--s3);
	overflow-wrap: anywhere;
}

/* A rejected submission, said where the button is rather than behind it. */
.ale-verdict__error {
	background: var(--c-danger-soft);
	border-radius: var(--r-sm);
	color: var(--c-text);
	font-size: var(--t-small);
	margin: 0 0 var(--s3);
	overflow-wrap: anywhere;
	padding: var(--s2) var(--s3);
}

/* The right answer, shown only after a wrong one. */
/*
 * The verdict reads as three beats: what you chose, why it does not hold, and
 * what does. Each one is a short labelled block instead of a paragraph, so a
 * learner scanning on a phone sees the shape of the correction at a glance.
 */
.ale-answer {
	border-radius: var(--r-sm);
	margin: 0 0 var(--s3);
	padding: var(--s3);
}

.ale-answer--yours {
	background: var(--c-bg-sunken);
	border: 1px solid var(--rule);
}

.ale-answer--right {
	background: var(--surface);
	border: 1px solid var(--verify);
}

.ale-answer__label {
	font-size: var(--t-caption);
	font-weight: 700;
	letter-spacing: 0.06em;
	margin: 0 0 var(--s1);
	text-transform: uppercase;
}

.ale-answer--yours .ale-answer__label {
	color: var(--ink-soft);
}

.ale-answer--right .ale-answer__label {
	color: var(--verify);
}

.ale-answer__text {
	font-size: var(--t-body);
	margin: 0;
	overflow-wrap: anywhere;
}

.ale-why {
	margin: 0 0 var(--s3);
}

.ale-why__label {
	color: var(--ink-soft);
	font-size: var(--t-caption);
	font-weight: 700;
	letter-spacing: 0.06em;
	margin: 0 0 var(--s1);
	text-transform: uppercase;
}

.ale-why .ale-verdict__text {
	margin: 0;
}

/*
 * The contractual citation stays word for word — it is what makes an answer
 * traceable — but folded. Printed open it was the longest thing on screen and
 * the explanation got lost behind a list of page numbers.
 */
.ale-source {
	background: var(--c-surface-alt);
	border-left: 3px solid var(--brass);
	border-radius: 0 var(--r-sm) var(--r-sm) 0;
	margin: 0 0 var(--s3);
	overflow-wrap: anywhere;
	padding: var(--s2) var(--s3);
}

.ale-source__summary {
	color: var(--ink-soft);
	cursor: pointer;
	font-size: var(--t-caption);
	font-weight: 600;
	letter-spacing: 0.02em;
	list-style: none;
	min-height: var(--tap);
	align-items: center;
	display: flex;
}

.ale-source__summary::-webkit-details-marker {
	display: none;
}

.ale-source__summary::after {
	content: "＋";
	margin-left: auto;
	padding-left: var(--s2);
}

.ale-source[open] .ale-source__summary::after {
	content: "－";
}

.ale-source__text {
	color: var(--ink-soft);
	font-size: var(--t-caption);
	line-height: 1.5;
	margin: var(--s1) 0 0;
	overflow-wrap: anywhere;
}

/* ============================== BUTTONS =============================== */

.ale-btn {
	align-items: center;
	background: var(--primary);
	border: 1.5px solid var(--primary);
	border-radius: 14px;
	color: var(--on-primary);
	display: flex;
	font-family: var(--font-doc);
	font-size: var(--t-body);
	font-weight: 700;
	justify-content: center;
	min-height: var(--tap-lg);
	padding: var(--s3) var(--s5);
	text-align: center;
	text-decoration: none;
	transition: transform 140ms var(--ease), background 140ms var(--ease);
	width: 100%;
}

.ale-btn:hover {
	background: var(--primary-hover);
	border-color: var(--primary-hover);
	cursor: pointer;
}

.ale-btn:active {
	transform: scale(0.985);
}

.ale-btn[disabled] {
	background: var(--c-bg-sunken);
	border-color: var(--c-bg-sunken);
	color: var(--ink-soft);
	cursor: not-allowed;
}

.ale-btn--ghost {
	background: transparent;
	border-color: var(--rule-strong);
	color: var(--ink);
}

.ale-btn--ghost:hover {
	background: var(--c-bg-sunken);
	border-color: var(--rule-strong);
}

.ale-btn--inline {
	display: inline-flex;
	width: auto;
}

.ale-actions {
	display: grid;
	gap: var(--s2);
	margin-top: var(--s3);
}

/* ============================== RESULT ================================ */

.ale-result {
	padding-top: var(--s5);
	text-align: center;
}

.ale-result__score {
	font-family: var(--font-doc);
	font-size: 2.6rem;
	font-weight: 800;
	line-height: 1;
	margin: var(--s3) 0 var(--s2);
}

.ale-result__stats {
	display: grid;
	gap: var(--s2);
	grid-template-columns: repeat(3, minmax(0, 1fr));
	margin: var(--s5) 0;
}

.ale-result__stat {
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--r-md);
	padding: var(--s3) var(--s2);
}

.ale-result__stat dt {
	color: var(--ink-soft);
	font-size: 0.62rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.ale-result__stat dd {
	font-family: var(--font-doc);
	font-size: 1.2rem;
	font-weight: 700;
	margin: var(--s1) 0 0;
}

/* ============================== PROFILE =============================== */

.ale-profile {
	align-items: center;
	background: linear-gradient(140deg, var(--c-secondary) 0%, var(--c-primary) 100%);
	border-radius: var(--r-hero);
	box-shadow: var(--shadow);
	color: var(--on-primary);
	display: flex;
	gap: var(--s4);
	margin-bottom: var(--s3);
	padding: var(--s5);
}

.ale-profile__avatar svg {
	border: 3px solid rgba(255, 255, 255, 0.5);
	border-radius: 50%;
	display: block;
}

.ale-profile__name {
	font-size: var(--t-hero);
	margin: 0 0 2px;
}

.ale-profile__meta {
	color: rgba(255, 255, 255, 0.88);
	font-size: var(--t-small);
	margin: 0;
}

.ale-dimension {
	margin-bottom: var(--s4);
}

.ale-dimension__head {
	align-items: baseline;
	display: flex;
	gap: var(--s2);
	justify-content: space-between;
}

.ale-dimension__name {
	font-size: var(--t-body);
	font-weight: 600;
}

.ale-dimension__value {
	color: var(--ink-soft);
	font-family: var(--font-doc);
	font-size: var(--t-small);
	font-weight: 700;
}

/* ============================== RANKING =============================== */

.ale-ranking {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ale-ranking__row {
	align-items: center;
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--r-md);
	display: flex;
	gap: var(--s3);
	margin-bottom: var(--s2);
	min-height: var(--tap-lg);
	padding: var(--s3);
}

.ale-ranking__row--you {
	background: var(--primary-soft);
	border-color: var(--primary);
}

.ale-ranking__pos {
	align-items: center;
	background: var(--c-bg-sunken);
	border-radius: 50%;
	display: flex;
	flex: 0 0 30px;
	font-family: var(--font-doc);
	font-size: var(--t-small);
	font-weight: 700;
	height: 30px;
	justify-content: center;
}

.ale-ranking__name {
	flex: 1 1 auto;
	font-size: var(--t-body);
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ale-ranking__xp {
	font-family: var(--font-doc);
	font-size: var(--t-small);
	font-weight: 700;
}

/* ============================ NAVIGATION ============================== */

.ale-tabbar {
	background: var(--surface);
	border-top: 1px solid var(--rule);
	bottom: 0;
	display: flex;
	left: 0;
	padding-bottom: env(safe-area-inset-bottom, 0px);
	position: fixed;
	right: 0;
	z-index: 20;
}

.ale-tabbar a {
	align-items: center;
	color: var(--ink-soft);
	display: flex;
	flex: 1 1 0;
	flex-direction: column;
	gap: 2px;
	justify-content: center;
	min-height: 60px;
	padding: var(--s2) 2px;
	text-align: center;
	text-decoration: none;
}

.ale-tabbar__label {
	font-size: 0.66rem;
	font-weight: 600;
}

.ale-tabbar a[aria-current="page"] {
	color: var(--primary);
}

.ale-tabbar a[aria-current="page"] .ale-ico {
	background: var(--primary-soft);
}

.ale-ico {
	align-items: center;
	border-radius: var(--r-pill);
	display: inline-flex;
	height: 28px;
	justify-content: center;
	transition: background 160ms var(--ease);
	width: 42px;
}

.ale-icon {
	display: block;
	height: 22px;
	width: 22px;
}

.ale--runner-open .ale-tabbar {
	display: none;
}

/* ============================== STATES ================================ */

.ale-notice,
.ale-alert {
	border: 1px solid var(--rule);
	border-left-width: 4px;
	border-radius: var(--r-md);
	margin: 0 0 var(--s4);
	padding: var(--s3) var(--s4);
}

.ale-alert--danger {
	background: var(--flag-soft);
	border-left-color: var(--flag);
	color: var(--flag);
}

.ale-alert--warning {
	background: var(--brass-soft);
	border-left-color: var(--brass);
	color: var(--brass);
}

.ale-state {
	margin: 0 auto;
	max-width: 420px;
	padding: var(--s8) var(--s4);
	text-align: center;
}

.ale-state__art {
	align-items: center;
	background: var(--primary-soft);
	border-radius: var(--r-pill);
	display: inline-flex;
	height: 84px;
	justify-content: center;
	margin-bottom: var(--s4);
	width: 84px;
}

.ale-state__art svg {
	display: block;
	height: 100%;
	width: 100%;
}

.ale-state__title {
	font-family: var(--font-doc);
	font-size: var(--t-screen);
	margin: 0 0 var(--s2);
}

.ale-state__text {
	color: var(--ink-soft);
	font-size: var(--t-body);
	margin: 0 0 var(--s5);
}

.ale-state__actions {
	display: grid;
	gap: var(--s2);
}

.ale-empty {
	color: var(--ink-soft);
	padding: var(--s8) 0;
	text-align: center;
}

/* ----------------------------- skeletons ------------------------------ */

.ale-skeleton {
	animation: ale-pulse 1.4s ease-in-out infinite;
	background: var(--c-border-soft);
	border-radius: var(--r-md);
	display: block;
}

.ale-skeleton--title { height: 28px; margin-bottom: var(--s3); width: 62%; }
.ale-skeleton--line  { height: 14px; margin-bottom: var(--s2); width: 100%; }
.ale-skeleton--card  { height: 120px; margin-bottom: var(--s3); }
.ale-skeleton--node  { border-radius: var(--r-pill); height: var(--node); margin: 0 0 var(--s3); width: var(--node); }

@keyframes ale-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.55; }
}

/* =============================== GATE ================================= */

.ale-gate {
	align-items: center;
	display: flex;
	justify-content: center;
	min-height: 70vh;
	padding: var(--s6) var(--gutter);
}

.ale-gate__card {
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--r-hero);
	box-shadow: var(--shadow);
	max-width: 420px;
	padding: var(--s6) var(--s5);
	width: 100%;
}

.ale-gate__title {
	font-size: var(--t-hero);
	margin: var(--s5) 0 var(--s2);
}

.ale-gate__lead {
	color: var(--ink-soft);
	font-size: var(--t-body);
	margin: 0 0 var(--s5);
}

.ale-gate__aside {
	font-size: var(--t-small);
	margin: var(--s4) 0 0;
}

.ale-gate__aside a {
	color: var(--primary);
}

.ale-wordmark {
	align-items: center;
	display: inline-flex;
	gap: var(--s2);
}

.ale-wordmark__text {
	color: var(--c-secondary);
	font-family: var(--font-doc);
	font-size: var(--t-section);
	font-weight: 800;
	letter-spacing: -0.02em;
}

.ale-wordmark--lg .ale-wordmark__text {
	font-size: 1.4rem;
}

.ale-tabs {
	background: var(--c-bg-sunken);
	border-radius: var(--r-sm);
	display: flex;
	gap: var(--s1);
	margin: 0 0 var(--s5);
	padding: var(--s1);
}

.ale-tab {
	background: none;
	border: none;
	border-radius: var(--r-sm);
	color: var(--ink-soft);
	flex: 1 1 0;
	font-weight: 700;
	min-height: var(--tap);
	padding: var(--s2);
}

.ale-tab:hover {
	cursor: pointer;
}

.ale-tab[aria-selected="true"] {
	background: var(--surface);
	box-shadow: var(--shadow-sm);
	color: var(--primary);
}

.ale-pane[hidden] {
	display: none;
}

#ale-login p,
#ale-signup p {
	margin: 0 0 var(--s3);
}

#ale-login label,
#ale-signup label {
	display: block;
	font-size: var(--t-small);
	font-weight: 600;
	margin-bottom: var(--s1);
}

#ale-login input[type="text"],
#ale-login input[type="password"],
#ale-signup input[type="text"],
#ale-signup input[type="email"],
#ale-signup input[type="password"] {
	background: var(--surface);
	border: 1.5px solid var(--rule);
	border-radius: 14px;
	font: inherit;
	min-height: var(--tap-lg);
	padding: var(--s3);
	width: 100%;
}

#ale-login .login-remember label {
	font-weight: 400;
}

#ale-login .login-submit input,
#ale-signup .login-submit input {
	background: var(--primary);
	border: 1.5px solid var(--primary);
	border-radius: 14px;
	color: var(--on-primary);
	cursor: pointer;
	font: inherit;
	font-weight: 700;
	min-height: var(--tap-lg);
	width: 100%;
}

#ale-login .login-submit input:hover,
#ale-signup .login-submit input:hover {
	background: var(--primary-hover);
	border-color: var(--primary-hover);
}

/* Off-screen rather than display:none, so form fillers still see it. */
.ale-honeypot {
	height: 1px;
	left: -9999px;
	overflow: hidden;
	position: absolute;
	width: 1px;
}

.ale-hint {
	color: var(--ink-soft);
	display: block;
	font-size: var(--t-caption);
	margin-top: var(--s1);
}

.ale-label {
	display: block;
	font-weight: 600;
	margin-bottom: var(--s2);
}

/* ============================= SPLASH ================================= */

.ale-splash {
	align-items: center;
	background: var(--paper);
	display: flex;
	flex-direction: column;
	inset: 0;
	justify-content: center;
	position: fixed;
	z-index: 90;
}

.ale-app[data-boot="ready"] .ale-splash {
	display: none;
}

.ale-splash__msg {
	color: var(--ink-soft);
	font-size: var(--t-body);
	margin: var(--s4) 0 var(--s5);
}

.ale-splash__bar {
	background: var(--c-border-soft);
	border-radius: var(--r-pill);
	height: 6px;
	overflow: hidden;
	width: 180px;
}

.ale-splash__bar span {
	animation: ale-indeterminate 1.4s ease-in-out infinite;
	background: var(--primary);
	display: block;
	height: 100%;
	width: 40%;
}

@keyframes ale-indeterminate {
	0% { transform: translateX(-100%); }
	100% { transform: translateX(350%); }
}

/* =========================== AVATAR CREATOR =========================== */

.ale-onboard {
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--r-hero);
	box-shadow: var(--shadow-sm);
	padding: var(--s6) var(--s5);
}

.ale-bullets {
	color: var(--ink-soft);
	font-size: var(--t-body);
	margin: 0 0 var(--s5);
	padding-left: var(--s5);
}

.ale-bullets li {
	margin-bottom: var(--s2);
}

.ale-creator {
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--r-lg);
	display: flex;
	flex-direction: column;
	/*
	 * A bounded column instead of sticky offsets: the avatar and the category
	 * strip never move, and only the option panel scrolls. No magic `top`
	 * values that drift when the header height changes.
	 */
	max-height: calc(100vh - 210px);
	min-height: 420px;
	overflow: hidden;
}

.ale-creator__stage {
	background: linear-gradient(160deg, var(--c-primary-soft) 0%, var(--c-surface) 100%);
	border-bottom: 1px solid var(--rule);
	display: flex;
	flex: 0 0 auto;
	justify-content: center;
	padding: var(--s4);
}

.ale-creator__figure .ale-avatar svg {
	background: var(--surface);
	border: 3px solid var(--surface);
	border-radius: 50%;
	box-shadow: var(--shadow);
	height: 132px;
	width: 132px;
}

/* Category strip: horizontal, scrollable, one tap per section. */
.ale-creator__tabs {
	background: var(--surface);
	border-bottom: 1px solid var(--rule);
	display: flex;
	flex: 0 0 auto;
	gap: var(--s1);
	overflow-x: auto;
	padding: var(--s2) var(--s2) 0;
	scrollbar-width: none;
}

.ale-creator__tabs::-webkit-scrollbar {
	display: none;
}

.ale-creator__tab {
	align-items: center;
	background: none;
	border: none;
	border-bottom: 3px solid transparent;
	color: var(--ink-soft);
	display: flex;
	flex: 0 0 auto;
	flex-direction: column;
	gap: 3px;
	min-height: 58px;
	min-width: 68px;
	padding: var(--s2) var(--s3);
}

.ale-creator__tab:hover {
	cursor: pointer;
}

.ale-creator__tab[aria-selected="true"] {
	border-bottom-color: var(--primary);
	color: var(--primary);
}

.ale-creator__tabicon {
	align-items: center;
	display: flex;
	height: 24px;
	justify-content: center;
}

.ale-creator__tablabel {
	font-size: 0.64rem;
	font-weight: 700;
	white-space: nowrap;
}

/* The only scrolling region. */
.ale-creator__panel {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: var(--s4);
	-webkit-overflow-scrolling: touch;
}

.ale-creator__panel:focus {
	outline: none;
}

.ale-creator__legend {
	color: var(--ink-soft);
	font-size: var(--t-caption);
	font-weight: 700;
	letter-spacing: 0.06em;
	margin: 0 0 var(--s3);
	text-transform: uppercase;
}

.ale-creator__options {
	display: grid;
	gap: var(--s2);
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ale-creator__options--color {
	grid-template-columns: repeat(5, minmax(0, 1fr));
	justify-items: center;
}

.ale-creator__save {
	border-top: 1px solid var(--rule);
	flex: 0 0 auto;
	padding: var(--s3) var(--s4);
	padding-bottom: calc(var(--s3) + env(safe-area-inset-bottom, 0px));
}

.ale-swatch {
	background: var(--surface);
	border: 1.5px solid var(--rule);
	border-radius: var(--r-sm);
	font-size: var(--t-small);
	min-height: var(--tap-lg);
	padding: var(--s2) var(--s3);
	transition: transform 140ms var(--ease);
	width: 100%;
}

.ale-swatch:hover {
	border-color: var(--rule-strong);
	cursor: pointer;
}

.ale-swatch:active {
	transform: scale(0.96);
}

.ale-swatch[aria-checked="true"] {
	background: var(--primary-soft);
	border-color: var(--primary);
	color: var(--primary);
	font-weight: 700;
}

.ale-swatch--color {
	border-radius: var(--r-sm);
	height: 46px;
	padding: 0;
	width: 46px;
}

.ale-swatch--color[aria-checked="true"] {
	box-shadow: 0 0 0 3px var(--primary);
}

.ale-avatar svg {
	display: block;
}

/* ============================ BREAKPOINTS ============================= */

/* Phones: the matching grid stacks so a long left-hand term is never squeezed
 * into half a narrow screen. */
@media (max-width: 640px) {
	.ale-matching th,
	.ale-matching td {
		display: block;
		width: 100%;
	}

	.ale-matching th {
		padding-bottom: var(--s1);
	}
}

/* Very small phones: tighten the gutter before anything can overflow. */
@media (max-width: 374px) {
	.ale {
		--gutter: 12px;
		--node: 46px;
	}

	.ale-missions {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.ale-stat dt {
		display: none;
	}
}

/* Tablet: more air, wider measure, two columns where it helps. */
@media (min-width: 768px) {
	.ale-creator__options {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.ale-creator__options--color {
		grid-template-columns: repeat(7, minmax(0, 1fr));
	}

	.ale-creator__figure .ale-avatar svg {
		height: 164px;
		width: 164px;
	}

	.ale-creator {
		max-height: calc(100vh - 240px);
	}

	.ale {
		--gutter: 24px;
	}

	.ale-main {
		max-width: 720px;
		padding-top: var(--s6);
	}

	.ale-hero {
		padding: var(--s6);
	}

	.ale-metrics,
	.ale-result__stats {
		gap: var(--s3);
	}

	.ale-actions {
		grid-auto-flow: column;
		justify-content: start;
	}

	.ale-actions .ale-btn {
		width: auto;
	}
}

/* Desktop: persistent sidebar, no bottom bar, reading measure kept sane. */
@media (min-width: 1024px) {
	.ale {
		padding-bottom: 0;
	}

	.ale-app {
		display: grid;
		grid-template-columns: 248px 1fr;
		min-height: 100vh;
	}

	.ale-sidebar {
		background: var(--surface);
		border-right: 1px solid var(--rule);
		display: flex;
		flex-direction: column;
		gap: var(--s2);
		height: 100vh;
		padding: var(--s5) var(--s4);
		position: sticky;
		top: 0;
	}

	.ale-sidebar__nav {
		display: flex;
		flex-direction: column;
		gap: 2px;
		margin-top: var(--s5);
	}

	.ale-sidebar__nav a {
		align-items: center;
		border-radius: var(--r-sm);
		color: var(--ink-soft);
		display: flex;
		font-size: var(--t-body);
		font-weight: 600;
		gap: var(--s3);
		min-height: var(--tap);
		padding: var(--s2) var(--s3);
		text-decoration: none;
	}

	.ale-sidebar__nav a:hover {
		background: var(--c-bg-sunken);
	}

	.ale-sidebar__nav a[aria-current="page"] {
		background: var(--primary-soft);
		color: var(--primary);
	}

	.ale-sidebar__nav .ale-ico {
		height: 24px;
		width: 24px;
	}

	.ale-sidebar__out {
		color: var(--ink-soft);
		font-size: var(--t-small);
		margin-top: auto;
		padding: var(--s2) var(--s3);
	}

	.ale-tabbar {
		display: none;
	}

	.ale-main {
		max-width: 860px;
		padding: var(--s6) var(--s6) var(--s8);
	}

	/* An activity is a reading task: keep the measure comfortable. */
	.ale-runner__body {
		max-width: 720px;
	}

	.ale-topbar {
		position: sticky;
	}
}

@media (min-width: 1440px) {
	.ale-main {
		max-width: 960px;
	}
}

/* ========================== USER PREFERENCES ========================== */

@media (prefers-reduced-motion: reduce) {
	.ale *,
	.ale *::before,
	.ale *::after {
		animation: none !important;
		transition: none !important;
	}
}

@media (prefers-contrast: more) {
	.ale {
		--rule: var(--c-border-strong);
	}
}

/* ======================================================================
 * Recognition: four cups and the award animation.
 * ==================================================================== */

.ale-cups {
	display: grid;
	gap: var(--s2);
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin-bottom: var(--s5);
}

.ale-cup {
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--r-lg);
	padding: var(--s4) var(--s3);
	text-align: center;
}

/* Locked cups stay legible: dimmed and drained of metal, never hidden. */
.ale-cup--locked {
	filter: grayscale(0.9);
	opacity: 0.62;
}

.ale-cup--lapsed {
	border-color: var(--brass);
	filter: none;
	opacity: 1;
}

.ale-cup__art svg {
	display: block;
	margin: 0 auto var(--s2);
}

.ale-cup__name {
	font-family: var(--font-doc);
	font-size: var(--t-body);
	font-weight: 800;
	margin: 0;
}

.ale-cup__meta {
	color: var(--ink-soft);
	font-size: var(--t-caption);
	margin: var(--s1) 0 0;
	overflow-wrap: anywhere;
}

.ale-cup__meta--warn {
	color: var(--brass);
	font-weight: 700;
}

.ale-cup__code {
	color: var(--ink-soft);
	font-family: var(--font-code);
	font-size: 0.68rem;
	letter-spacing: 0.04em;
	margin: var(--s1) 0 0;
}

.ale-cup .ale-meter {
	margin-top: var(--s2);
}

/* ------------------------------- award -------------------------------- */

.ale-award {
	align-items: center;
	background: var(--c-overlay);
	display: flex;
	inset: 0;
	justify-content: center;
	padding: var(--s5);
	position: fixed;
	z-index: 95;
}

.ale-award__card {
	animation: ale-award-in 480ms var(--ease);
	background: var(--surface);
	border-radius: var(--r-hero);
	box-shadow: var(--shadow-lift);
	max-width: 340px;
	padding: var(--s6) var(--s5);
	position: relative;
	text-align: center;
	width: 100%;
}

@keyframes ale-award-in {
	0% { opacity: 0; transform: scale(0.84) translateY(14px); }
	60% { transform: scale(1.03); }
	100% { opacity: 1; transform: none; }
}

.ale-award__cup svg {
	animation: ale-cup-in 1.4s var(--ease) 120ms both;
	display: block;
	margin: 0 auto;
}

@keyframes ale-cup-in {
	0% { opacity: 0; transform: scale(0.6) rotate(-9deg); }
	55% { opacity: 1; transform: scale(1.08) rotate(3deg); }
	100% { opacity: 1; transform: none; }
}

.ale-award__title {
	font-family: var(--font-doc);
	font-size: 1.3rem;
	margin: var(--s4) 0 var(--s1);
}

.ale-award__text {
	color: var(--ink-soft);
	font-size: var(--t-small);
	margin: 0 0 var(--s4);
}

.ale-award .ale-btn {
	margin-top: var(--s4);
}

.ale-spark {
	background: var(--brass);
	border-radius: 50%;
	height: 7px;
	left: 50%;
	opacity: 0;
	pointer-events: none;
	position: absolute;
	top: 32%;
	width: 7px;
}

@media (min-width: 768px) {
	.ale-cups {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}
