/**
 * Accessibility Pro Plus
 *
 * 1. Fonts (self-hosted, SIL OFL; downloaded only when a font option is chosen)
 * 2. Page adjustments: classes on <html> set by boot.js. Every rule skips the widget
 *    (.appx-ui) so the controls stay usable whatever the page looks like.
 * 3. Widget: launcher, tooltip, panel (light/dark), controls.
 *
 * Widget sizes use px on purpose: the text-size feature scales the site (rem), not the panel,
 * so the panel never overflows. Browser zoom still scales everything.
 */

/* 1. Fonts ---------------------------------------------------------------- */

@font-face {
	font-family: "APPX Atkinson Hyperlegible";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/atkinson-hyperlegible-400.woff2") format("woff2");
}

@font-face {
	font-family: "APPX Atkinson Hyperlegible";
	font-style: normal;
	font-weight: 700 900;
	font-display: swap;
	src: url("../fonts/atkinson-hyperlegible-700.woff2") format("woff2");
}

@font-face {
	font-family: "APPX OpenDyslexic";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/opendyslexic-400.woff2") format("woff2");
}

@font-face {
	font-family: "APPX OpenDyslexic";
	font-style: normal;
	font-weight: 700 900;
	font-display: swap;
	src: url("../fonts/opendyslexic-700.woff2") format("woff2");
}

/* 2. Page adjustments ----------------------------------------------------- */

/* Text size: scales rem-based text and spacing (most themes, including block themes). */
html.appx-on-text {
	font-size: calc(100% * var(--appx-scale, 1)) !important;
}

/* Filters on the root element (high contrast, saturation, grayscale). The root is exempt from
 * the "filter creates a containing block" rule, so fixed headers and bars keep working. */
html.appx-on-filter {
	filter: var(--appx-filter);
}

/* Dark contrast: white text on black, yellow links. Images and CSS-drawn logos are kept. */
html.appx-on-dark,
html.appx-on-dark body {
	background: #000 !important;
	color: #fff !important;
}

/* :where() keeps this base rule weak, so the link, control and highlight rules below win. */
html.appx-on-dark body :where(*:not(.appx-ui, .appx-ui *, .appx-guide, .appx-mask)) {
	border-color: #fff !important;
	background-color: #000 !important;
	box-shadow: none !important;
	text-shadow: none !important;
	color: #fff !important;
}

/* Light contrast only: decorative pseudo-element layers (dark scrims, glows) are removed so black
 * text never sits on a dark overlay. (In dark contrast those layers are dark anyway.) */
html.appx-on-light body *:not(.appx-ui *)::before,
html.appx-on-light body *:not(.appx-ui *)::after {
	background-color: transparent !important;
	background-image: none !important;
	box-shadow: none !important;
}

html.appx-on-dark body a:not(.appx-ui *),
html.appx-on-dark body a:not(.appx-ui *) * {
	color: #ffe14d !important;
}

html.appx-on-dark body :is(button, input, select, textarea, .wp-element-button, [role="button"]):not(.appx-ui *) {
	box-shadow: inset 0 0 0 2px #fff !important;
}

html.appx-on-dark body ::placeholder {
	color: #d0d0d0 !important;
	opacity: 1 !important;
}

/* Light contrast: black text on white, dark blue links. */
html.appx-on-light,
html.appx-on-light body {
	background: #fff !important;
	color: #000 !important;
}

/* :where() keeps this base rule weak, so the link, control and highlight rules below win. */
html.appx-on-light body :where(*:not(.appx-ui, .appx-ui *, .appx-guide, .appx-mask)) {
	border-color: #000 !important;
	background-color: #fff !important;
	box-shadow: none !important;
	text-shadow: none !important;
	color: #000 !important;
}

html.appx-on-light body a:not(.appx-ui *),
html.appx-on-light body a:not(.appx-ui *) * {
	color: #0033cc !important;
}

html.appx-on-light body :is(button, input, select, textarea, .wp-element-button, [role="button"]):not(.appx-ui *) {
	box-shadow: inset 0 0 0 2px #000 !important;
}

html.appx-on-light body ::placeholder {
	color: #4a4a4a !important;
	opacity: 1 !important;
}

/* Highlight links: underlined, on a yellow highlighter, readable on any background. */
html.appx-on-links body a:not(.appx-ui *):not(.appx-skip) {
	outline: 2px solid #0b1626 !important;
	outline-offset: 1px !important;
	background-color: #fff0a0 !important;
	color: #0b1626 !important;
	text-decoration: underline !important;
	text-decoration-thickness: 2px !important;
	text-underline-offset: 3px !important;
}

html.appx-on-links body a:not(.appx-ui *):not(.appx-skip) * {
	color: #0b1626 !important;
}

/* Highlight headings: amber outline with a navy edge, visible on dark and light. */
html.appx-on-headings body :is(h1, h2, h3, h4, h5, h6, [role="heading"]):not(.appx-ui *) {
	outline: 3px solid #ffbf00 !important;
	outline-offset: 4px !important;
	box-shadow: 0 0 0 9px #0b1626 !important;
}

/* Text spacing (WCAG 1.4.12 values at "Wide"). */
html.appx-on-spacing-medium body *:not(.appx-ui):not(.appx-ui *) {
	letter-spacing: 0.05em !important;
	word-spacing: 0.08em !important;
}

html.appx-on-spacing-wide body *:not(.appx-ui):not(.appx-ui *) {
	letter-spacing: 0.12em !important;
	word-spacing: 0.16em !important;
}

html.appx-on-spacing-wide body p:not(.appx-ui *) {
	margin-bottom: 2em !important;
}

/* Reflow aid: with enlarged text, wider spacing or a wider font, long words may break rather
 * than push the page wider than the screen (WCAG 1.4.10). */
html:is(.appx-on-text, .appx-on-spacing, .appx-on-font) body *:not(.appx-ui):not(.appx-ui *) {
	overflow-wrap: anywhere;
}

/* Sticky/fixed elements that grew taller than 30% of the screen scroll with the page (set by the
 * main script while text settings are on). */
[data-appx-unstuck] {
	position: relative !important;
	inset: auto !important;
	transform: none !important;
}

/* Line height. */
html.appx-on-lh body *:not(.appx-ui):not(.appx-ui *) {
	line-height: var(--appx-lh, 1.5) !important;
}

/* Fonts. Icon fonts and code keep their own families. */
html.appx-on-font-readable body *:not(.appx-ui):not(.appx-ui *):not(code):not(pre):not(kbd):not(samp):not([class*="icon"]):not([class*="dashicons"]):not([class*="fa-"]) {
	font-family: "APPX Atkinson Hyperlegible", Verdana, Tahoma, sans-serif !important;
}

html.appx-on-font-dyslexic body *:not(.appx-ui):not(.appx-ui *):not(code):not(pre):not(kbd):not(samp):not([class*="icon"]):not([class*="dashicons"]):not([class*="fa-"]) {
	font-family: "APPX OpenDyslexic", "Comic Sans MS", Verdana, sans-serif !important;
}

/* Text alignment. */
html.appx-on-align-left body *:not(.appx-ui):not(.appx-ui *) {
	text-align: left !important;
}

html.appx-on-align-center body *:not(.appx-ui):not(.appx-ui *) {
	text-align: center !important;
}

html.appx-on-align-right body *:not(.appx-ui):not(.appx-ui *) {
	text-align: right !important;
}

/* Large clickable areas: controls and navigation links get at least a 44 x 44 px target.
 * Links inside running text keep their layout (they get taller line boxes instead). */
html.appx-on-targets body :is(button, [role="button"], select, summary, input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), .wp-block-button__link, .wp-element-button):not(.appx-ui *) {
	min-width: 44px !important;
	min-height: 44px !important;
}

html.appx-on-targets body :is(nav a, header a, footer a, li > a:only-child):not(.appx-ui *):not(.appx-skip) {
	display: inline-flex !important;
	align-items: center;
	min-width: 44px;
	min-height: 44px !important;
}

html.appx-on-targets body :is(p, li, dd, td) a:not(.appx-ui *) {
	padding-block: 0.3em !important;
	line-height: 2 !important;
}

html.appx-on-targets body label:has(input[type="checkbox"], input[type="radio"]):not(.appx-ui *) {
	min-height: 44px;
}

/* Inverted colors: the root filter inverts the page; photos and video are inverted back so they
 * look natural. (Images drawn as CSS backgrounds stay inverted.) */
html.appx-on-invert body :is(img, picture, video, canvas, iframe):not(.appx-ui *) {
	filter: invert(1) hue-rotate(180deg) !important;
}

html.appx-on-invert body picture img {
	filter: none !important;
}

/* Highlight selected text. */
html.appx-on-selection ::selection {
	background: #ffd400 !important;
	color: #000 !important;
}

/* Large cursor (devices with a fine pointer). */
@media (pointer: fine) {
	html.appx-on-cursor,
	html.appx-on-cursor * {
		cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M8 4l30 18-13 3 8 15-6 3-8-15-11 9z' fill='%23000' stroke='%23fff' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E") 8 4, auto !important;
	}

	html.appx-on-cursor :is(a, button, [role="button"], label, summary, select, input[type="checkbox"], input[type="radio"], input[type="range"], input[type="submit"]),
	html.appx-on-cursor :is(a, button, [role="button"], label, summary) * {
		cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M8 4l30 18-13 3 8 15-6 3-8-15-11 9z' fill='%230b54b8' stroke='%23fff' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E") 8 4, pointer !important;
	}

	html.appx-on-cursor :is(input:not([type]), input[type="text"], input[type="email"], input[type="tel"], input[type="search"], input[type="url"], input[type="number"], input[type="password"], textarea) {
		cursor: text !important;
	}
}

/* Focus highlight: amber ring with a navy edge on whatever has keyboard focus. */
html.appx-on-focus :focus-visible {
	outline: 3px solid #ffbf00 !important;
	outline-offset: 3px !important;
	box-shadow: 0 0 0 8px #0b1626 !important;
}

/* Stop animations (also part of "Reduce distractions"). */
html.appx-on-motion,
html.appx-on-distraction {
	scroll-behavior: auto !important;
}

html.appx-on-motion *,
html.appx-on-motion *::before,
html.appx-on-motion *::after,
html.appx-on-distraction *,
html.appx-on-distraction *::before,
html.appx-on-distraction *::after {
	animation-duration: 0.001ms !important;
	animation-delay: 0s !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0.001ms !important;
	transition-delay: 0s !important;
	scroll-behavior: auto !important;
}

/* Reduce distractions: hide images and video (layout kept), drop shadows. */
html.appx-on-distraction body :is(img, picture, video, canvas):not(.appx-ui *) {
	visibility: hidden !important;
}

html.appx-on-distraction body *:not(.appx-ui):not(.appx-ui *) {
	box-shadow: none !important;
	text-shadow: none !important;
}

/* Read-aloud: the block being read. */
.appx-speaking {
	outline: 3px solid #ffbf00 !important;
	outline-offset: 4px !important;
	background-color: rgba(255, 191, 0, 0.16) !important;
}

/* Reading guide and mask. */
.appx-guide {
	position: fixed;
	top: 0;
	right: 0;
	left: 0;
	z-index: 2147483500;
	height: 8px;
	border-radius: 4px;
	background: #ffbf00;
	box-shadow: 0 0 0 2px #0b1626;
	pointer-events: none;
	will-change: transform;
}

.appx-mask {
	position: fixed;
	right: 0;
	left: 0;
	z-index: 2147483499;
	background: rgba(4, 8, 16, 0.62);
	pointer-events: none;
}

.appx-mask--top {
	top: 0;
	height: 0;
}

.appx-mask--bottom {
	top: 100vh;
	bottom: 0;
}

/* Skip links (visible on focus). */
.appx-skiplinks {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 2147483646;
}

.appx-skip {
	position: absolute;
	top: 12px;
	left: 12px;
	padding: 12px 18px;
	border-radius: 8px;
	background: #0b1626;
	color: #fff !important;
	font: 600 16px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	max-width: calc(100vw - 24px);
	text-decoration: underline;
	transform: translateY(-300%);
}

.appx-skip:focus {
	outline: 3px solid #ffbf00;
	outline-offset: 2px;
	transform: none;
}

/* 3. Widget ---------------------------------------------------------------- */

.appx-ui {
	--appx-brand: #0a84f0;
	--appx-on-brand: #fff;
	--appx-accent-light: #0b54b8;
	--appx-accent-dark: #6cb6ff;
	--appx-offset: 24px;
	--appx-offset-mobile: 16px;
	--appx-size: 48px;
	--appx-size-mobile: 48px;
	--appx-lift: 0px;
	--appx-bg: #f3f6fa;
	--appx-card: #fff;
	--appx-text: #0b1626;
	--appx-muted: #4a5b70;
	--appx-line: #dbe3ec;
	--appx-track: #c3cdd9;
	--appx-accent: var(--appx-accent-light);
	--appx-on-accent: #fff;
	--appx-hover: #eef3f9;
	--appx-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--appx-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

.appx-ui[data-theme="dark"] {
	--appx-bg: #0f1726;
	--appx-card: #18233a;
	--appx-text: #eef3f9;
	--appx-muted: #a9b9cc;
	--appx-line: #2c3b55;
	--appx-track: #4a5b70;
	--appx-accent: var(--appx-accent-dark);
	--appx-on-accent: #0b1626;
	--appx-hover: #20304c;
}

@media (prefers-color-scheme: dark) {
	.appx-ui[data-theme="auto"] {
		--appx-bg: #0f1726;
		--appx-card: #18233a;
		--appx-text: #eef3f9;
		--appx-muted: #a9b9cc;
		--appx-line: #2c3b55;
		--appx-track: #4a5b70;
		--appx-accent: var(--appx-accent-dark);
		--appx-on-accent: #0b1626;
		--appx-hover: #20304c;
	}
}

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

.appx-ui :is(h2, h3, p, ul, li, fieldset, legend, button, input, output, label, section) {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	letter-spacing: normal;
	text-align: left;
	text-transform: none;
	text-shadow: none;
	color: inherit;
	list-style: none;
}

.appx-ui [hidden] {
	display: none !important;
}

.appx-ui .appx-icon {
	flex: none;
	width: 20px;
	height: 20px;
	fill: currentColor;
}

.appx-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.appx-filters {
	position: absolute;
	width: 0;
	height: 0;
	overflow: hidden;
}

/* Launcher: the button is never smaller than 44 x 44 px; the visible disc can be 40-72 px. */
.appx-launcher {
	position: fixed;
	right: calc(18px + env(safe-area-inset-right));
	bottom: calc(var(--appx-offset) + var(--appx-lift) + env(safe-area-inset-bottom));
	z-index: 2147483600;
	transition: bottom 0.25s var(--appx-ease), opacity 0.2s ease, transform 0.2s ease;
}

.appx-ui[data-position="left"] .appx-launcher {
	right: auto;
	left: calc(18px + env(safe-area-inset-left));
}

.appx-ui .appx-bubble {
	position: relative;
	display: grid;
	place-items: center;
	width: max(var(--appx-size), 44px);
	height: max(var(--appx-size), 44px);
	border-radius: 50%;
	cursor: pointer;
}

.appx-bubble__disc {
	display: grid;
	place-items: center;
	width: var(--appx-size);
	height: var(--appx-size);
	border-radius: 50%;
	background: var(--appx-brand);
	box-shadow: 0 0 0 2px #fff, 0 6px 18px rgba(4, 10, 24, 0.3);
	color: var(--appx-on-brand);
	transition: transform 0.2s var(--appx-ease), box-shadow 0.2s ease;
}

.appx-ui .appx-bubble__disc .appx-icon {
	width: 62%;
	height: 62%;
}

@media (hover: hover) {
	.appx-ui .appx-bubble:hover .appx-bubble__disc {
		transform: scale(1.06);
		box-shadow: 0 0 0 2px #fff, 0 8px 22px rgba(4, 10, 24, 0.38);
	}
}

.appx-ui .appx-bubble:focus-visible {
	outline: none;
}

.appx-ui .appx-bubble:focus-visible .appx-bubble__disc {
	box-shadow: 0 0 0 2px #fff, 0 0 0 5px #0b1626, 0 0 0 7px #fff, 0 6px 18px rgba(4, 10, 24, 0.3);
}

.appx-badge {
	position: absolute;
	top: -3px;
	right: -3px;
	display: grid;
	place-items: center;
	min-width: 19px;
	height: 19px;
	padding: 0 5px;
	border: 2px solid var(--appx-brand);
	border-radius: 10px;
	background: #fff;
	font: 700 11px/1 var(--appx-font);
	color: #0b1626;
}

.appx-tip {
	position: absolute;
	top: 50%;
	right: calc(100% + 10px);
	padding: 6px 10px;
	border-radius: 6px;
	background: #0b1626;
	font: 600 13px/1.2 var(--appx-font);
	color: #fff;
	white-space: nowrap;
	opacity: 0;
	visibility: hidden;
	transform: translate(4px, -50%);
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.appx-ui[data-position="left"] .appx-tip {
	right: auto;
	left: calc(100% + 10px);
	transform: translate(-4px, -50%);
}

.appx-launcher:hover .appx-tip,
.appx-bubble:focus-visible ~ .appx-tip {
	opacity: 1;
	visibility: visible;
	transform: translate(0, -50%);
}

.appx-tip-off .appx-tip,
.appx-is-open .appx-tip {
	opacity: 0 !important;
	visibility: hidden !important;
}

.appx-tucked .appx-launcher {
	opacity: 0;
	pointer-events: none;
	transform: scale(0.85);
}

/* Panel: compact main menu (320 px) and a wider settings view (372 px), both with internal scroll. */
.appx-panel {
	position: fixed;
	right: calc(16px + env(safe-area-inset-right));
	bottom: calc(16px + env(safe-area-inset-bottom));
	z-index: 2147483601;
	display: flex;
	width: min(320px, calc(100vw - 32px));
	max-height: calc(100dvh - 32px);
	overflow: hidden;
	overflow: clip; /* Only the inner list scrolls: focus or scrollIntoView must never scroll the header away. */
	border: 1px solid var(--appx-line);
	border-radius: 16px;
	background: var(--appx-bg);
	box-shadow: 0 18px 48px rgba(4, 10, 24, 0.24), 0 2px 6px rgba(4, 10, 24, 0.08);
	font: 400 15px/1.4 var(--appx-font);
	color: var(--appx-text);
	opacity: 0;
	transform: translateY(10px);
	transition: opacity 0.18s ease, transform 0.22s var(--appx-ease), width 0.2s var(--appx-ease);
}

.appx-panel[data-view="settings"] {
	width: min(372px, calc(100vw - 32px));
}

.appx-ui[data-position="left"] .appx-panel {
	right: auto;
	left: calc(16px + env(safe-area-inset-left));
}

.appx-is-shown .appx-panel {
	opacity: 1;
	transform: none;
}

.appx-view {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
	max-height: 100%;
}

.appx-head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 12px 12px 14px;
	border-bottom: 1px solid var(--appx-line);
	background: var(--appx-card);
}

.appx-head__mark {
	display: grid;
	flex: none;
	place-items: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--appx-brand);
	color: var(--appx-on-brand);
}

.appx-ui .appx-head__mark .appx-icon {
	width: 20px;
	height: 20px;
}

.appx-ui .appx-title {
	flex: 1;
	min-width: 0;
	font: 700 16px/1.25 var(--appx-font);
	color: var(--appx-text);
}

.appx-ui .appx-title:focus {
	outline: none;
}

.appx-ui .appx-title:focus-visible {
	outline: 2px solid var(--appx-accent);
	outline-offset: 2px;
	border-radius: 4px;
}

.appx-ui .appx-iconbtn {
	display: grid;
	flex: none;
	place-items: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	color: var(--appx-text);
	cursor: pointer;
}

@media (hover: hover) {
	.appx-ui .appx-iconbtn:hover {
		background: var(--appx-hover);
	}
}

.appx-scroll {
	flex: 1;
	min-height: 0;
	padding: 10px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.appx-ui .appx-hint {
	margin: 2px 4px 8px;
	font-size: 12.5px;
	line-height: 1.4;
	color: var(--appx-muted);
}

.appx-ui .appx-list {
	overflow: hidden;
	border: 1px solid var(--appx-line);
	border-radius: 12px;
	background: var(--appx-card);
}

.appx-ui .appx-list li + li {
	border-top: 1px solid var(--appx-line);
}

/* Rows: icon left, label centre, control right. */
.appx-ui .appx-row {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	min-height: 46px;
	padding: 8px 12px;
	font-size: 14.5px;
	color: var(--appx-text);
	cursor: pointer;
}

.appx-ui .appx-row > .appx-icon,
.appx-ui .appx-row__legend > .appx-icon {
	width: 20px;
	height: 20px;
	color: var(--appx-accent);
}

.appx-ui .appx-row__text {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.appx-ui .appx-row__label {
	flex: 1;
	min-width: 0;
	font-weight: 600;
	line-height: 1.25;
}

.appx-ui .appx-row__desc {
	font-size: 12px;
	line-height: 1.35;
	color: var(--appx-muted);
}

@media (hover: hover) {
	.appx-ui .appx-row:not(.appx-row--stack):not(.appx-row--stepper):hover {
		background: var(--appx-hover);
	}
}

.appx-ui .appx-row:focus-visible,
.appx-ui .appx-row--radio:has(input:focus-visible) {
	outline: 2px solid var(--appx-accent);
	outline-offset: -2px;
	border-radius: 10px;
}

.appx-ui .appx-row--profile {
	min-height: 56px;
	padding-block: 9px;
}

.appx-ui .appx-row--nav {
	margin-top: 10px;
	border: 1px solid var(--appx-line);
	border-radius: 12px;
	background: var(--appx-card);
}

.appx-ui .appx-card .appx-row--nav {
	margin-top: 0;
	border: 0;
	border-top: 1px solid var(--appx-line);
	border-radius: 0;
}

.appx-ui .appx-row--nav > .appx-icon:last-child {
	width: 18px;
	height: 18px;
	color: var(--appx-muted);
}

/* Switch: small track on the right. */
.appx-switch {
	position: relative;
	flex: none;
	width: 34px;
	height: 20px;
	border-radius: 10px;
	background: var(--appx-track);
	transition: background-color 0.15s ease;
}

.appx-switch::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
	transition: transform 0.15s var(--appx-ease);
}

.appx-ui [aria-checked="true"] > .appx-switch {
	background: var(--appx-accent);
}

.appx-ui [aria-checked="true"] > .appx-switch::after {
	transform: translateX(14px);
}

/* Cards in the settings view. */
.appx-ui .appx-card {
	overflow: hidden;
	border: 1px solid var(--appx-line);
	border-radius: 12px;
	background: var(--appx-card);
}

.appx-ui .appx-card + .appx-card {
	margin-top: 10px;
}

.appx-ui .appx-card__title {
	padding: 12px 12px 6px;
	font: 700 15px/1.25 var(--appx-font);
	color: var(--appx-text);
}

.appx-ui .appx-card > .appx-row + .appx-row,
.appx-ui .appx-card > .appx-row + .appx-radios,
.appx-ui .appx-card > .appx-radios + .appx-row {
	border-top: 1px solid var(--appx-line);
}

/* Stepper (text size). */
.appx-ui .appx-row--stepper {
	cursor: default;
}

.appx-stepper {
	display: flex;
	flex: none;
	align-items: center;
	gap: 4px;
}

.appx-ui .appx-stepbtn {
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	border: 1px solid var(--appx-line);
	border-radius: 8px;
	background: var(--appx-card);
	color: var(--appx-text);
	cursor: pointer;
}

.appx-ui .appx-stepbtn .appx-icon {
	width: 16px;
	height: 16px;
}

.appx-ui .appx-stepbtn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.appx-ui .appx-stepper__value {
	min-width: 46px;
	font-size: 14px;
	font-weight: 700;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

/* Stacked rows (label above a segmented control, slider or buttons). */
.appx-ui .appx-row--stack {
	display: block;
	cursor: default;
}

.appx-ui .appx-row__legend {
	display: flex;
	align-items: center;
	gap: 12px;
	float: left;
	width: 100%;
	margin-bottom: 8px;
	font-weight: 600;
}

.appx-seg {
	clear: both;
	display: grid;
	grid-auto-columns: minmax(0, 1fr);
	grid-auto-flow: column;
	gap: 3px;
	padding: 3px;
	border-radius: 9px;
	background: var(--appx-bg);
}

.appx-seg__opt {
	position: relative;
	display: block;
	cursor: pointer;
}

.appx-seg__opt input,
.appx-ui .appx-row--radio input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.appx-ui .appx-seg__opt span {
	display: grid;
	place-items: center;
	min-height: 32px;
	padding: 4px 2px;
	border-radius: 7px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.15;
	text-align: center;
	color: var(--appx-text);
}

.appx-seg__opt input:checked + span {
	background: var(--appx-card);
	box-shadow: 0 1px 3px rgba(4, 10, 24, 0.18), inset 0 0 0 1.5px var(--appx-accent);
	color: var(--appx-accent);
}

.appx-seg__opt input:focus-visible + span {
	outline: 2px solid var(--appx-accent);
	outline-offset: 1px;
}

/* Radio list (color modes): dot on the right. */
.appx-ui .appx-radios {
	min-width: 0;
}

.appx-ui .appx-radios .appx-row + .appx-row {
	border-top: 1px solid var(--appx-line);
}

.appx-radio {
	position: relative;
	flex: none;
	width: 20px;
	height: 20px;
	border: 2px solid var(--appx-track);
	border-radius: 50%;
	background: var(--appx-card);
}

.appx-ui .appx-row--radio:has(input:checked) .appx-radio {
	border-color: var(--appx-accent);
}

.appx-ui .appx-row--radio:has(input:checked) .appx-radio::after {
	content: "";
	position: absolute;
	inset: 3px;
	border-radius: 50%;
	background: var(--appx-accent);
}

.appx-ui .appx-row--radio:has(input:checked) {
	background: color-mix(in srgb, var(--appx-accent) 7%, var(--appx-card));
}

/* Slider. */
.appx-ui .appx-range__value {
	margin-left: auto;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.appx-row--range input[type="range"] {
	clear: both;
	display: block;
	width: 100%;
	height: 24px;
	margin: 0;
	accent-color: var(--appx-accent);
	cursor: pointer;
}

.appx-row--range input[type="range"]:focus-visible {
	outline: 2px solid var(--appx-accent);
	outline-offset: 2px;
	border-radius: 4px;
}

/* Read aloud buttons. */
.appx-speech__controls {
	clear: both;
	display: grid;
	grid-template-columns: 1.3fr 1fr 1fr;
	gap: 6px;
}

.appx-ui .appx-speech__status {
	margin-left: auto;
	font-size: 12.5px;
	color: var(--appx-accent);
}

.appx-ui .appx-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 36px;
	padding: 0 10px;
	border: 1px solid var(--appx-line);
	border-radius: 8px;
	background: var(--appx-card);
	font-size: 13.5px;
	font-weight: 600;
	color: var(--appx-text);
	cursor: pointer;
}

.appx-ui .appx-btn .appx-icon {
	width: 16px;
	height: 16px;
}

.appx-ui .appx-btn--primary {
	border-color: var(--appx-accent);
	background: var(--appx-accent);
	color: var(--appx-on-accent);
}

.appx-ui .appx-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.appx-ui :is(.appx-btn, .appx-iconbtn, .appx-stepbtn, .appx-link):focus-visible {
	outline: 2px solid var(--appx-accent);
	outline-offset: 2px;
}

.appx-ui .appx-note {
	padding: 8px 12px 0;
	font-size: 12px;
	line-height: 1.4;
	color: var(--appx-muted);
}

.appx-ui .appx-note:last-child {
	padding-bottom: 12px;
}

/* Footer: status + reset all. */
.appx-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 10px 8px 14px;
	padding-bottom: calc(8px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--appx-line);
	background: var(--appx-card);
}

.appx-ui .appx-foot__status {
	font-size: 12.5px;
	color: var(--appx-muted);
}

.appx-has-active .appx-foot__status {
	font-weight: 700;
	color: var(--appx-accent);
}

.appx-ui .appx-link {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 5px;
	min-height: 32px;
	padding: 0 8px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	color: var(--appx-accent);
	cursor: pointer;
}

.appx-ui .appx-link .appx-icon {
	width: 16px;
	height: 16px;
}

@media (hover: hover) {
	.appx-ui .appx-link:hover {
		background: var(--appx-hover);
	}
}

/* Phones: compact launcher, panel as a bottom sheet. */
@media (max-width: 600px) {
	.appx-launcher {
		right: calc(12px + env(safe-area-inset-right));
		bottom: calc(var(--appx-offset-mobile) + var(--appx-lift) + env(safe-area-inset-bottom));
	}

	.appx-ui[data-position="left"] .appx-launcher {
		left: calc(12px + env(safe-area-inset-left));
	}

	.appx-ui .appx-bubble {
		width: max(var(--appx-size-mobile), 44px);
		height: max(var(--appx-size-mobile), 44px);
	}

	.appx-bubble__disc {
		width: var(--appx-size-mobile);
		height: var(--appx-size-mobile);
	}

	.appx-panel,
	.appx-panel[data-view="settings"],
	.appx-ui[data-position="left"] .appx-panel {
		right: 0;
		bottom: 0;
		left: 0;
		width: 100%;
		max-height: min(92dvh, 100%);
		border-width: 1px 0 0;
		border-radius: 16px 16px 0 0;
	}

	.appx-tip {
		display: none;
	}
}

@media (max-width: 340px) {
	.appx-speech__controls {
		grid-template-columns: 1fr;
	}
}

@media (max-height: 520px) {
	.appx-panel {
		bottom: 8px;
		max-height: calc(100dvh - 16px);
	}

	.appx-ui .appx-hint {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.appx-ui *,
	.appx-ui *::after,
	.appx-launcher,
	.appx-panel {
		transition: none !important;
	}
}

html.appx-on-motion .appx-launcher,
html.appx-on-motion .appx-panel {
	transition: none !important;
}

@media (forced-colors: active) {
	.appx-bubble__disc,
	.appx-panel,
	.appx-ui .appx-card,
	.appx-switch,
	.appx-radio {
		border: 2px solid ButtonText;
	}

	.appx-ui [aria-checked="true"] > .appx-switch,
	.appx-ui .appx-row--radio:has(input:checked) .appx-radio,
	.appx-seg__opt input:checked + span {
		outline: 3px solid Highlight;
	}
}

@media print {
	.appx-ui,
	.appx-skiplinks,
	.appx-guide,
	.appx-mask {
		display: none !important;
	}
}
