/*
 * Accessibility mode.
 *
 * Loaded on every page (component.A11yAssets). a11y_boot.js stamps the saved
 * profile on <html> before first paint and everything here keys off those
 * attributes:
 *
 *   html[data-a11y]                      mode on: focus rings, bigger targets
 *   html[data-a11y-scale-mode="css"]     text scale on desktop engines
 *   html[data-a11y-contrast="night|day"] high-contrast palettes
 *   html[data-a11y-font]                 legible typeface + spacing
 *   html[data-a11y-motion]               calm motion
 *
 * followed by the UI the mode adds: the Listen control and image
 * descriptions on practice cards, the floating dock, the control panel
 * (.tta-*), and the Settings page entry. "tta" = Tutorio accessibility.
 */

/* ============================================================
   1. Text scale
   ============================================================ */

/* Mobile engines scale through -webkit-text-size-adjust (set inline by the
   boot script). Elsewhere rem text follows the root and a11y.js re-issues
   every px font size multiplied by --tt-a11y-scale. */
html[data-a11y-scale-mode="css"] {
	font-size: calc(100% * var(--tt-a11y-scale, 1));
}

/* Larger text needs room: let fixed-height rows grow instead of clipping. */
html[data-a11y-text] li[data-type] .pickBtn,
html[data-a11y-text] .button-footer .btn {
	height: auto !important;
	white-space: normal !important;
}
html[data-a11y-text] li[data-type] .pick-options-container > [class*="col-md-6"] {
	flex: 0 0 100%;
	max-width: 100%;
}

/* ============================================================
   2. Always on with the mode: focus and targets
   ============================================================ */

html[data-a11y] {
	--tta-focus: #ff9f0a;
}
html[data-a11y-contrast="night"] { --tta-focus: #ffd60a; }
html[data-a11y-contrast="day"] { --tta-focus: #0b2bd6; }

html[data-a11y] :focus-visible {
	outline: 4px solid var(--tta-focus) !important;
	outline-offset: 3px !important;
}

html[data-a11y] li[data-type] .pickBtn { min-height: 64px !important; }
html[data-a11y] .button-footer .btn { min-height: 60px; }
html[data-a11y] li[data-type] .text-content a,
html[data-a11y] li[data-type] .question-text a {
	text-decoration: underline !important;
	text-underline-offset: 3px;
}

/* ============================================================
   3. High contrast - night (white + yellow on black)
   ============================================================
   Sits on the dark theme (the boot script forces data-theme="dark"), so the
   token overrides below reach everything dark mode already covers. */

html[data-a11y-contrast="night"][data-theme] {
	color-scheme: dark;

	--tt-bg: #000;
	--tt-surface: #000;
	--tt-surface-2: #0d0d0d;
	--tt-surface-3: #1f1f1f;
	--tt-line: #8c8c8c;
	--tt-line-strong: #fff;
	--tt-ink: #fff;
	--tt-muted: #e6e6e6;

	--cd-accent: #ffd60a;
	--cd-accent-hover: #ffe45c;
	--cd-accent-soft: rgba(255, 214, 10, 0.2);
	--cd-ink: #fff;
	--cd-muted: #e6e6e6;
	--cd-line: #8c8c8c;
	--cd-card: #000;
	--cd-bg: #000;
	--cd-glass: #000;

	--border-color: #8c8c8c;
	--bg-white: #000;
	--title: #fff;

	--bs-body-color: #fff;
	--bs-body-bg: #000;
	--bs-body-color-rgb: 255, 255, 255;
	--bs-body-bg-rgb: 0, 0, 0;
	--bs-light: #0d0d0d;
	--bs-light-rgb: 13, 13, 13;
	--bs-dark: #fff;
	--bs-dark-rgb: 255, 255, 255;
	--bs-gray-100: #0d0d0d;
	--bs-gray-200: #1f1f1f;
	--bs-gray-300: #8c8c8c;
	--bs-gray-400: #a6a6a6;
	--bs-gray-500: #cfcfcf;
	--bs-gray-600: #e6e6e6;
	--bs-gray-700: #f2f2f2;
	--bs-gray-800: #fff;
	--bs-gray-900: #fff;

	--adm-bg: #000;
	--adm-card: #000;
	--adm-border: #8c8c8c;
	--adm-text: #fff;
	--adm-muted: #e6e6e6;
}

html[data-a11y-contrast="night"] body {
	background: #000 !important;
	color: #fff;
}

html[data-a11y-contrast="night"] li[data-uuid][data-type] {
	background: #000 !important;
	border: 2px solid #fff !important;
	box-shadow: none !important;
}
html[data-a11y-contrast="night"] li[data-type] :is(.question-text, .text-content, .pairs-title, h2, .fib, .form-label, p, li, span:not([class])) {
	color: #fff !important;
}
html[data-a11y-contrast="night"] li[data-type] :is(.text-content, .question-text) a { color: #ffd60a !important; }

html[data-a11y-contrast="night"] .pickBtn:not(.btn-success):not(.btn-danger) {
	background: #000 !important;
	border: 2px solid #fff !important;
	color: #fff !important;
	box-shadow: none !important;
}
html[data-a11y-contrast="night"] .pickBtn:not(.btn-success):not(.btn-danger):hover {
	background: #000 !important;
	border-color: #ffd60a !important;
	box-shadow: 0 0 0 3px #ffd60a !important;
}
html[data-a11y-contrast="night"] .pickBtn:not(.btn-success):not(.btn-danger) .option-indicator {
	background: #ffd60a !important;
	border-color: #ffd60a !important;
	color: #000 !important;
}
html[data-a11y-contrast="night"][data-theme] li[data-type] .pickBtn.pickBtn.btn-success {
	background: #00e676 !important;
	border-color: #00e676 !important;
	color: #000 !important;
}
html[data-a11y-contrast="night"][data-theme] li[data-type] .pickBtn.pickBtn.btn-danger {
	background: #ff6b6b !important;
	border-color: #ff6b6b !important;
	color: #000 !important;
}
html[data-a11y-contrast="night"][data-theme] li[data-type] .pickBtn.pickBtn:is(.btn-success, .btn-danger) :is(.option-text, .option-indicator) {
	color: #000 !important;
}

html[data-a11y-contrast="night"] li[data-type] :is(.question-response, .fill-text-container, input[type="text"], .itemzone, .dropzone) {
	background: #000 !important;
	border-color: #fff !important;
	color: #fff !important;
}
html[data-a11y-contrast="night"] li[data-type] ::placeholder { color: #cfcfcf !important; opacity: 1; }

html[data-a11y-contrast="night"] :is(.btn-primary, .btn-primary.light):not(.pickBtn):not(:disabled) {
	background: #ffd60a !important;
	border-color: #ffd60a !important;
	color: #000 !important;
	box-shadow: none !important;
}
html[data-a11y-contrast="night"] :is(.btn-primary, .btn-primary.light):not(.pickBtn):not(:disabled) :is(i, span) {
	color: #000 !important;
}
html[data-a11y-contrast="night"] .btn-primary:disabled {
	background: #1f1f1f !important;
	border-color: #8c8c8c !important;
	color: #cfcfcf !important;
}

html[data-a11y-contrast="night"] .header,
html[data-a11y-contrast="night"] .header .main-bar {
	background: #000 !important;
	border-bottom: 2px solid #fff;
	box-shadow: none !important;
}
html[data-a11y-contrast="night"] .button-footer.footer.fixed,
html[data-a11y-contrast="night"] .footer.fixed {
	background: #000 !important;
	border-top: 2px solid #fff !important;
	box-shadow: none !important;
}

/* ============================================================
   4. High contrast - day (black on white, bold edges)
   ============================================================ */

html[data-a11y-contrast="day"][data-theme] {
	color-scheme: light;
	--bs-body-color: #000;
	--bs-body-color-rgb: 0, 0, 0;
	--bs-body-bg: #fff;
	--title: #000;
	--border-color: #000;
	--cd-ink: #000;
	--cd-muted: #1f1f1f;
	--cd-line: #000;
	--cd-accent: #0b2bd6;
	--cd-accent-hover: #0a22a8;
}

html[data-a11y-contrast="day"] body {
	background: #fff !important;
	color: #000;
}
html[data-a11y-contrast="day"] :is(.text-muted, small, .form-label) { color: #1f1f1f !important; }

html[data-a11y-contrast="day"] li[data-uuid][data-type] {
	background: #fff !important;
	border: 2px solid #000 !important;
	box-shadow: none !important;
}
html[data-a11y-contrast="day"] li[data-type] :is(.question-text, .text-content, .pairs-title, h2, .fib, .form-label, p, li, span:not([class])) {
	color: #000 !important;
}
html[data-a11y-contrast="day"] li[data-type] :is(.text-content, .question-text) a { color: #0b2bd6 !important; }

html[data-a11y-contrast="day"] .pickBtn:not(.btn-success):not(.btn-danger) {
	background: #fff !important;
	border: 2px solid #000 !important;
	color: #000 !important;
	box-shadow: none !important;
}
html[data-a11y-contrast="day"] .pickBtn:not(.btn-success):not(.btn-danger):hover {
	border-color: #0b2bd6 !important;
	box-shadow: 0 0 0 3px #0b2bd6 !important;
}
html[data-a11y-contrast="day"] .pickBtn:not(.btn-success):not(.btn-danger) .option-indicator {
	background: #000 !important;
	border-color: #000 !important;
	color: #fff !important;
}
html[data-a11y-contrast="day"][data-theme] li[data-type] .pickBtn.pickBtn.btn-success {
	background: #0a6b2d !important;
	border-color: #0a6b2d !important;
	color: #fff !important;
}
html[data-a11y-contrast="day"][data-theme] li[data-type] .pickBtn.pickBtn.btn-danger {
	background: #a40e26 !important;
	border-color: #a40e26 !important;
	color: #fff !important;
}
html[data-a11y-contrast="day"][data-theme] li[data-type] .pickBtn.pickBtn:is(.btn-success, .btn-danger) :is(.option-text, .option-indicator) {
	color: #fff !important;
}

html[data-a11y-contrast="day"] li[data-type] :is(.question-response, .fill-text-container, input[type="text"], .itemzone, .dropzone) {
	background: #fff !important;
	border-color: #000 !important;
	color: #000 !important;
}
html[data-a11y-contrast="day"] li[data-type] ::placeholder { color: #404040 !important; opacity: 1; }

html[data-a11y-contrast="day"] :is(.btn-primary, .btn-primary.light):not(.pickBtn):not(:disabled) {
	background: #0b2bd6 !important;
	border-color: #0b2bd6 !important;
	color: #fff !important;
	box-shadow: none !important;
}
html[data-a11y-contrast="day"] :is(.btn-primary, .btn-primary.light):not(.pickBtn):not(:disabled) :is(i, span) {
	color: #fff !important;
}

html[data-a11y-contrast="day"] .header,
html[data-a11y-contrast="day"] .header .main-bar {
	background: #fff !important;
	border-bottom: 2px solid #000;
	box-shadow: none !important;
}
html[data-a11y-contrast="day"] .button-footer.footer.fixed,
html[data-a11y-contrast="day"] .footer.fixed {
	background: #fff !important;
	border-top: 2px solid #000 !important;
	box-shadow: none !important;
}

/* Both palettes: decorative layers that wash out the content go. */
html[data-a11y-contrast] li[data-type="image"] > .ttc-ambient,
html[data-a11y-contrast] li[data-type="image"] > div[aria-hidden="true"],
html[data-a11y-contrast] #particles-js {
	display: none !important;
}

/* ============================================================
   5. Legible typeface
   ============================================================ */

/* Icon fonts and typeset maths keep their own faces. */
html[data-a11y-font] body,
html[data-a11y-font] body :not(i, .fa, .fas, .far, .fab, .fad, [class*="fa-"], [class*="icon"], [class*="MathJax"], [class*="MathJax"] *, [class*="mjx"], [class*="mjx"] *, code, pre, kbd, samp) {
	font-family: "Atkinson Hyperlegible", Verdana, Tahoma, system-ui, sans-serif !important;
}
html[data-a11y-font] li[data-type] :is(.text-content, .question-text, h2, .option-text, .pairs-title, .fib) {
	letter-spacing: 0.02em;
	word-spacing: 0.08em;
}
html[data-a11y-font] li[data-type] .text-content { line-height: 1.75 !important; }
html[data-a11y-font] li[data-type] .option-text { line-height: 1.4 !important; }

/* ============================================================
   6. Calm motion
   ============================================================ */

html[data-a11y-motion] *:not(.content-loader-ring, .spinner-border, .spinner-grow, .tta-say-icon > i),
html[data-a11y-motion] *::before,
html[data-a11y-motion] *::after {
	animation-duration: 0.01ms !important;
	animation-delay: 0s !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0.01ms !important;
	transition-delay: 0s !important;
	scroll-behavior: auto !important;
}
html[data-a11y-motion]::view-transition-group(*),
html[data-a11y-motion]::view-transition-old(*),
html[data-a11y-motion]::view-transition-new(*) {
	animation-duration: 0.01ms !important;
}
html[data-a11y-motion] #particles-js,
html[data-a11y-motion] #tsparticles,
html[data-a11y-motion] .combo-badge {
	display: none !important;
}

/* ============================================================
   7. Practice cards: Listen control, reading glow, descriptions
   ============================================================ */

.tta-say,
.tta-dock,
.tta-root {
	--a-on: linear-gradient(135deg, #7c5cff 0%, #5b8cff 55%, #22d3ee 100%);
	--a-on-flat: #7c5cff;
	--a-on-ink: #fff;
}
/* The dock and panel are sized large to begin with and must stay put
   whatever text size is chosen; the Listen control grows with the card. */
.tta-dock,
.tta-root {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}
html[data-a11y-contrast="night"] :is(.tta-say, .tta-dock, .tta-root) {
	--a-on: #ffd60a;
	--a-on-flat: #ffd60a;
	--a-on-ink: #000;
}
html[data-a11y-contrast="day"] :is(.tta-say, .tta-dock, .tta-root) {
	--a-on: #0b2bd6;
	--a-on-flat: #0b2bd6;
	--a-on-ink: #fff;
}

.tta-say {
	clear: both;
	display: flex;
	align-items: center;
	gap: 10px;
	width: fit-content;
	min-height: 48px;
	margin: 18px 0 0 auto;
	padding: 8px 20px 8px 10px;
	border-radius: 999px;
	background: var(--a-on);
	color: var(--a-on-ink);
	font-size: 1rem;
	font-weight: 800;
	letter-spacing: 0.01em;
	line-height: 1;
	cursor: pointer;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	box-shadow: 0 8px 22px -8px var(--a-on-flat);
	transition: transform 0.18s ease, box-shadow 0.18s ease;
	position: relative;
	z-index: 2;
}
.tta-say:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -8px var(--a-on-flat); }
.tta-say:active { transform: scale(0.96); }

.tta-say-icon {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 3px;
	width: 32px;
	height: 32px;
	flex: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.22);
}
html[data-a11y-contrast] .tta-say-icon { background: transparent; }
.tta-say-icon svg { width: 20px; height: 20px; }
.tta-say-icon i {
	display: none;
	width: 4px;
	height: 14px;
	border-radius: 2px;
	background: currentColor;
	transform-origin: center;
	/* The equaliser is the "it is speaking" signal, so the calm motion
	   rule above leaves it running. */
	animation: tta-bars 0.9s ease-in-out infinite;
}
.tta-say-icon i:nth-child(3) { animation-delay: 0.15s; }
.tta-say-icon i:nth-child(4) { animation-delay: 0.3s; }
.tta-say-on .tta-say-icon svg { display: none; }
.tta-say-on .tta-say-icon i { display: block; }

@keyframes tta-bars {
	0%, 100% { transform: scaleY(0.35); }
	50% { transform: scaleY(1); }
}

li[data-type].tta-reading {
	box-shadow: 0 0 0 4px var(--tta-focus, #ff9f0a), 0 18px 44px -18px var(--tta-focus, #ff9f0a) !important;
}

.tta-alt {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	width: 100%;
	flex: 0 0 100%;
	margin: 14px 0 0;
	padding: 14px 16px;
	border-radius: 16px;
	border: 2px dashed rgba(124, 92, 255, 0.45);
	background: rgba(124, 92, 255, 0.08);
	color: inherit;
	font-size: 1rem;
	line-height: 1.5;
	text-align: left;
	position: relative;
	z-index: 1;
}
.tta-alt b {
	display: block;
	font-size: 0.72em;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0.75;
}
.tta-alt-icon { flex: none; width: 26px; height: 26px; color: #7c5cff; }
.tta-alt-icon svg { width: 100%; height: 100%; }
html[data-a11y-contrast="night"] .tta-alt { border-color: #fff; background: #000; color: #fff; }
html[data-a11y-contrast="night"] .tta-alt-icon { color: #ffd60a; }
html[data-a11y-contrast="day"] .tta-alt { border-color: #000; background: #fff; color: #000; }
html[data-a11y-contrast="day"] .tta-alt-icon { color: #0b2bd6; }

/* ============================================================
   8. Floating dock
   ============================================================ */

.tta-dock {
	position: fixed;
	left: calc(16px + env(safe-area-inset-left, 0px));
	bottom: calc(18px + env(safe-area-inset-bottom, 0px));
	z-index: 1040;
	display: flex;
	align-items: center;
	gap: 10px;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	animation: tta-dock-in 0.5s cubic-bezier(0.34, 1.4, 0.4, 1) both;
}
.tta-dock[hidden] { display: none; }
/* Clear the practice page's fixed answer bar. */
body:has(.footer.fixed) .tta-dock { bottom: calc(108px + env(safe-area-inset-bottom, 0px)); }
body.modal-open > .tta-dock { display: none; }

@keyframes tta-dock-in {
	from { opacity: 0; transform: translateY(18px) scale(0.8); }
	to { opacity: 1; transform: none; }
}

.tta-fab {
	position: relative;
	width: 58px;
	height: 58px;
	flex: none;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--a-on);
	color: var(--a-on-ink);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 12px 30px -10px var(--a-on-flat), 0 2px 6px rgba(0, 0, 0, 0.25);
	transition: transform 0.2s cubic-bezier(0.34, 1.5, 0.4, 1);
	-webkit-tap-highlight-color: transparent;
}
.tta-fab::before {
	content: "";
	position: absolute;
	inset: -5px;
	border-radius: 50%;
	border: 2px solid var(--a-on-flat);
	opacity: 0.45;
	animation: tta-halo 2.8s ease-out infinite;
}
.tta-fab svg { width: 34px; height: 34px; }
.tta-fab:hover { transform: scale(1.08) rotate(-6deg); }
.tta-fab:active { transform: scale(0.94); }
html[data-a11y-contrast="night"] .tta-fab { box-shadow: 0 0 0 3px #000; }
html[data-a11y-contrast="day"] .tta-fab { box-shadow: 0 0 0 3px #fff; }

@keyframes tta-halo {
	0% { transform: scale(0.92); opacity: 0.55; }
	70%, 100% { transform: scale(1.28); opacity: 0; }
}

.tta-listen {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	height: 52px;
	padding: 0 22px 0 10px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.16);
	background: rgba(13, 16, 34, 0.9);
	-webkit-backdrop-filter: blur(14px) saturate(1.5);
	backdrop-filter: blur(14px) saturate(1.5);
	color: #fff;
	font: 800 16px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	cursor: pointer;
	box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.55);
	transition: transform 0.18s ease, background 0.18s ease;
	-webkit-tap-highlight-color: transparent;
}
.tta-listen[hidden] { display: none; }
.tta-listen:hover { transform: translateY(-2px); }
.tta-listen .tta-say-icon { background: var(--a-on); color: var(--a-on-ink); }
.tta-listen.tta-say-on { background: var(--a-on); color: var(--a-on-ink); border-color: transparent; }
.tta-listen.tta-say-on .tta-say-icon { background: rgba(255, 255, 255, 0.22); color: inherit; }
html[data-a11y-contrast="night"] .tta-listen { background: #000; border: 2px solid #fff; }
html[data-a11y-contrast="day"] .tta-listen { background: #fff; color: #000; border: 2px solid #000; }
html[data-a11y-contrast] .tta-listen .tta-say-icon { color: var(--a-on-flat); }
html[data-a11y-contrast] .tta-listen.tta-say-on { background: var(--a-on); color: var(--a-on-ink); }
html[data-a11y-contrast] .tta-listen.tta-say-on .tta-say-icon { color: inherit; }
html[data-a11y-contrast] .tta-listen.tta-say-on .tta-say-icon { background: transparent; }

/* ============================================================
   9. Control panel
   ============================================================ */

.tta-root {
	--a-bg: #0b0d1c;
	--a-surface: rgba(255, 255, 255, 0.06);
	--a-surface-2: rgba(255, 255, 255, 0.11);
	--a-line: rgba(255, 255, 255, 0.14);
	--a-ink: #fff;
	--a-muted: #bcc3dc;
	--a-accent: #a99bff;

	position: fixed;
	inset: 0;
	z-index: 2000;
	visibility: hidden;
	pointer-events: none;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-size: 16px;
	line-height: 1.4;
	text-align: left;
	transition: visibility 0s linear 0.45s;
}
.tta-root[data-open="true"] {
	visibility: visible;
	pointer-events: auto;
	transition-delay: 0s;
}
html[data-a11y-contrast="night"] .tta-root {
	--a-bg: #000;
	--a-surface: #000;
	--a-surface-2: #1a1a1a;
	--a-line: #fff;
	--a-muted: #f0f0f0;
	--a-accent: #ffd60a;
}
html[data-a11y-contrast="day"] .tta-root {
	--a-bg: #fff;
	--a-surface: #fff;
	--a-surface-2: #ececec;
	--a-line: #000;
	--a-ink: #000;
	--a-muted: #1f1f1f;
	--a-accent: #0b2bd6;
}

.tta-root *,
.tta-root *::before,
.tta-root *::after { box-sizing: border-box; }
.tta-root button {
	font: inherit;
	color: inherit;
	text-align: left;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.tta-root [hidden] { display: none !important; }
.tta-root :focus-visible {
	outline: 3px solid var(--a-accent) !important;
	outline-offset: 3px !important;
}

/* The sheet takes focus on open only so the keyboard lands inside it. */
html .tta-root .tta-sheet.tta-sheet:focus-visible { outline: none !important; }

.tta-scrim {
	position: absolute;
	inset: 0;
	background: rgba(4, 6, 18, 0.55);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity 0.35s ease;
}
.tta-root[data-open="true"] .tta-scrim { opacity: 1; }

.tta-sheet {
	position: absolute;
	top: 12px;
	right: 12px;
	bottom: 12px;
	width: min(452px, calc(100vw - 24px));
	display: flex;
	flex-direction: column;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--a-line) transparent;
	border-radius: 30px;
	border: 1px solid var(--a-line);
	background: var(--a-bg);
	color: var(--a-ink);
	box-shadow: 0 40px 90px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(124, 92, 255, 0.18);
	outline: none;
	opacity: 0;
	transform: translateX(40px) scale(0.97);
	transition: transform 0.45s cubic-bezier(0.22, 1.2, 0.36, 1), opacity 0.3s ease;
}
.tta-root[data-open="true"] .tta-sheet {
	opacity: 1;
	transform: none;
}
html[data-a11y-contrast] .tta-sheet { border-width: 2px; box-shadow: none; }

/* Header */
.tta-head {
	position: relative;
	flex: none;
	padding: 26px 24px 22px;
	overflow: hidden;
	isolation: isolate;
}
.tta-aurora {
	position: absolute;
	inset: 0;
	z-index: -1;
	overflow: hidden;
	background: linear-gradient(160deg, #1a1446 0%, #0f1535 55%, var(--a-bg) 100%);
}
.tta-aurora i {
	position: absolute;
	width: 260px;
	height: 260px;
	border-radius: 50%;
	filter: blur(60px);
	opacity: 0.75;
	animation: tta-drift 14s ease-in-out infinite alternate;
}
.tta-aurora i:nth-child(1) { top: -120px; left: -70px; background: #7c5cff; }
.tta-aurora i:nth-child(2) { top: -90px; right: -110px; background: #22d3ee; opacity: 0.5; animation-delay: -5s; }
.tta-aurora i:nth-child(3) { bottom: -190px; left: 34%; background: #ff5fa2; opacity: 0.38; animation-delay: -9s; }
html[data-a11y-contrast] .tta-aurora { background: var(--a-bg); }
html[data-a11y-contrast] .tta-aurora i { display: none; }
html[data-a11y-contrast] .tta-head { border-bottom: 2px solid var(--a-line); }

@keyframes tta-drift {
	from { transform: translate3d(0, 0, 0) scale(1); }
	to { transform: translate3d(34px, 22px, 0) scale(1.18); }
}

.tta-close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 48px;
	height: 48px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid var(--a-line);
	background: var(--a-surface-2);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease, background 0.2s ease;
}
.tta-close svg { width: 22px; height: 22px; }
.tta-close:hover { transform: rotate(90deg); }

.tta-kicker {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 12px 6px 8px;
	border-radius: 999px;
	border: 1px solid var(--a-line);
	background: var(--a-surface-2);
	font-size: 12.5px;
	font-weight: 800;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--a-ink);
}
.tta-kicker svg { width: 20px; height: 20px; color: var(--a-accent); }

.tta-title {
	margin: 16px 56px 6px 0;
	font-size: 30px;
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.12;
	color: var(--a-ink);
}
.tta-sub {
	margin: 0 0 20px;
	font-size: 15.5px;
	line-height: 1.5;
	color: var(--a-muted);
}

.tta-master {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	min-height: 76px;
	padding: 14px 16px 14px 20px;
	border-radius: 22px;
	border: 1px solid var(--a-line);
	background: var(--a-surface-2);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.tta-master[aria-checked="true"] {
	background: var(--a-on);
	border-color: transparent;
	color: var(--a-on-ink);
	box-shadow: 0 16px 36px -16px var(--a-on-flat);
}
.tta-master-text,
.tta-row-text {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 3px;
}
.tta-master-text strong { font-size: 19px; font-weight: 800; }
.tta-master-text small { font-size: 14px; font-weight: 700; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.08em; }

/* Switch */
.tta-switch {
	position: relative;
	flex: none;
	width: 56px;
	height: 32px;
	border-radius: 999px;
	background: rgba(127, 127, 127, 0.35);
	border: 2px solid var(--a-line);
	transition: background 0.25s ease, border-color 0.25s ease;
}
.tta-switch span {
	position: absolute;
	top: 2px;
	left: 2px;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
	transition: transform 0.3s cubic-bezier(0.34, 1.5, 0.4, 1);
}
html[data-a11y-contrast="day"] .tta-switch span { background: #000; }
.tta-switch-lg { width: 68px; height: 38px; }
.tta-switch-lg span { width: 30px; height: 30px; }
[aria-checked="true"] > .tta-switch {
	background: var(--a-on-flat);
	border-color: var(--a-on-flat);
}
[aria-checked="true"] > .tta-switch span { transform: translateX(24px); background: var(--a-on-ink); }
[aria-checked="true"] > .tta-switch-lg span { transform: translateX(30px); }
.tta-master[aria-checked="true"] > .tta-switch {
	background: rgba(255, 255, 255, 0.28);
	border-color: rgba(255, 255, 255, 0.5);
}
html[data-a11y-contrast] .tta-master[aria-checked="true"] > .tta-switch {
	background: var(--a-on-ink);
	border-color: var(--a-on-ink);
}
html[data-a11y-contrast] .tta-master[aria-checked="true"] > .tta-switch span { background: var(--a-on-flat); }

/* Body */
.tta-body {
	flex: 1 0 auto;
	display: flex;
	flex-direction: column;
	gap: 26px;
	padding: 22px 24px 8px;
}

.tta-preset {
	position: relative;
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	padding: 16px 18px;
	border-radius: 22px;
	border: 1px solid transparent;
	background:
		linear-gradient(var(--a-bg), var(--a-bg)) padding-box,
		linear-gradient(120deg, #7c5cff, #22d3ee, #ff5fa2, #7c5cff) border-box;
	background-size: 100% 100%, 300% 100%;
	animation: tta-sheen 6s linear infinite;
	transition: transform 0.2s ease;
}
.tta-preset:hover { transform: translateY(-2px); }
.tta-preset-icon {
	flex: none;
	width: 46px;
	height: 46px;
	border-radius: 14px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--a-on);
	color: var(--a-on-ink);
}
.tta-preset-icon svg { width: 24px; height: 24px; }
html[data-a11y-contrast] .tta-preset { background: var(--a-bg); border: 2px solid var(--a-accent); animation: none; }

@keyframes tta-sheen {
	to { background-position: 0 0, 300% 0; }
}

.tta-row-text strong { font-size: 17px; font-weight: 700; color: var(--a-ink); }
.tta-row-text small { font-size: 14.5px; line-height: 1.4; color: var(--a-muted); }

.tta-sec { display: flex; flex-direction: column; gap: 10px; }
.tta-sec-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}
.tta-sec-head h3 {
	margin: 0;
	font-size: 13.5px;
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--a-muted);
}
.tta-val { font-size: 15px; font-weight: 800; color: var(--a-accent); }
.tta-note {
	margin: 0;
	padding: 12px 14px;
	border-radius: 14px;
	border: 1px solid var(--a-line);
	font-size: 14.5px;
	color: var(--a-muted);
}

/* Text size */
.tta-sizes {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 8px;
}
.tta-size {
	height: 72px;
	padding: 0 0 10px;
	border-radius: 18px;
	border: 1px solid var(--a-line);
	background: var(--a-surface);
	display: flex;
	align-items: flex-end;
	justify-content: center;
	font-weight: 800;
	line-height: 1;
	transition: transform 0.2s cubic-bezier(0.34, 1.5, 0.4, 1), background 0.2s ease, border-color 0.2s ease;
}
.tta-root .tta-size { text-align: center; }
.tta-size:hover { transform: translateY(-3px); background: var(--a-surface-2); }
.tta-size[aria-checked="true"] {
	background: var(--a-on);
	border-color: transparent;
	color: var(--a-on-ink);
	box-shadow: 0 14px 28px -14px var(--a-on-flat);
	transform: translateY(-3px);
}

/* Contrast tiles */
.tta-tiles {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
}
.tta-tile {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 3px;
	padding: 8px 8px 12px;
	border-radius: 20px;
	border: 2px solid var(--a-line);
	background: var(--a-surface);
	transition: transform 0.2s cubic-bezier(0.34, 1.5, 0.4, 1), border-color 0.2s ease;
}
.tta-tile:hover { transform: translateY(-3px); }
.tta-tile[aria-checked="true"] { border-color: var(--a-accent); }
.tta-tile-name { padding: 6px 4px 0; font-size: 16px; font-weight: 800; color: var(--a-ink); }
.tta-tile-sub { padding: 0 4px; font-size: 13px; line-height: 1.3; color: var(--a-muted); }
.tta-tick {
	position: absolute;
	top: -8px;
	right: -8px;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--a-on);
	color: var(--a-on-ink);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transform: scale(0);
	transition: transform 0.3s cubic-bezier(0.34, 1.7, 0.4, 1);
	box-shadow: 0 0 0 3px var(--a-bg);
}
.tta-tick svg { width: 16px; height: 16px; }
.tta-tile[aria-checked="true"] .tta-tick { transform: scale(1); }

.tta-mini {
	display: grid;
	grid-template-columns: 1fr;
	align-content: start;
	gap: 6px;
	height: 78px;
	padding: 11px 10px;
	border-radius: 13px;
	overflow: hidden;
}
.tta-mini b { height: 9px; width: 62%; border-radius: 5px; }
.tta-mini i { height: 5px; border-radius: 3px; }
.tta-mini i:nth-of-type(2) { width: 76%; }
.tta-mini u { height: 16px; width: 48%; margin-top: 4px; border-radius: 8px; }
.tta-tile-off .tta-mini { background: linear-gradient(140deg, #f4f6ff, #e6e9fb); }
.tta-tile-off .tta-mini b { background: #2b3160; }
.tta-tile-off .tta-mini i { background: #a9b0cf; }
.tta-tile-off .tta-mini u { background: linear-gradient(135deg, #7c5cff, #22d3ee); }
.tta-tile-night .tta-mini { background: #000; box-shadow: inset 0 0 0 2px #fff; }
.tta-tile-night .tta-mini b { background: #ffd60a; }
.tta-tile-night .tta-mini i { background: #fff; }
.tta-tile-night .tta-mini u { background: #ffd60a; }
.tta-tile-day .tta-mini { background: #fff; box-shadow: inset 0 0 0 2px #000; }
.tta-tile-day .tta-mini b { background: #000; }
.tta-tile-day .tta-mini i { background: #000; }
.tta-tile-day .tta-mini u { background: #0b2bd6; }

/* Switch rows */
.tta-row {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	min-height: 68px;
	padding: 12px 14px 12px 18px;
	border-radius: 20px;
	border: 1px solid var(--a-line);
	background: var(--a-surface);
	transition: background 0.2s ease, border-color 0.2s ease;
}
.tta-row:hover { background: var(--a-surface-2); }
.tta-row:disabled { opacity: 0.5; cursor: not-allowed; }
.tta-row[aria-checked="true"] { border-color: var(--a-accent); }

.tta-nest {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-left: 14px;
	padding-left: 14px;
	border-left: 2px solid var(--a-line);
	animation: tta-unfold 0.35s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}
@keyframes tta-unfold {
	from { opacity: 0; transform: translateY(-8px); }
	to { opacity: 1; transform: none; }
}

.tta-rate-row {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	font-size: 15px;
	font-weight: 700;
	color: var(--a-muted);
}
.tta-seg {
	flex: 1 1 auto;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 4px;
	padding: 4px;
	border-radius: 16px;
	border: 1px solid var(--a-line);
	background: var(--a-surface);
}
.tta-seg button {
	height: 44px;
	padding: 0 6px;
	border: 0;
	border-radius: 12px;
	background: transparent;
	font-size: 15px;
	font-weight: 800;
	color: var(--a-ink);
	transition: background 0.2s ease;
}
.tta-root .tta-seg button { text-align: center; }
.tta-seg button[aria-checked="true"] { background: var(--a-on); color: var(--a-on-ink); }
.tta-test {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 52px;
	padding: 0 18px 0 14px;
	border-radius: 16px;
	border: 1px solid var(--a-line);
	background: var(--a-surface-2);
	font-size: 15px;
	font-weight: 800;
}
.tta-root .tta-test { color: var(--a-ink); }
.tta-test svg { width: 20px; height: 20px; color: var(--a-accent); }

/* Footer */
.tta-foot {
	position: sticky;
	bottom: 0;
	z-index: 2;
	flex: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px;
	min-height: 58px;
	margin-top: 18px;
	padding: 12px 24px 16px;
	border-top: 1px solid var(--a-line);
	background: var(--a-bg);
	font-size: 13.5px;
	color: var(--a-muted);
}
.tta-keys kbd {
	display: inline-block;
	min-width: 24px;
	margin: 0 2px 0 6px;
	padding: 3px 7px;
	border-radius: 7px;
	border: 1px solid var(--a-line);
	background: var(--a-surface-2);
	font: 700 12px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	color: var(--a-ink);
	text-align: center;
	box-shadow: none;
}
.tta-keys kbd + kbd { margin-left: 0; }
.tta-saved {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-left: auto;
	padding: 7px 12px 7px 9px;
	border-radius: 999px;
	background: rgba(52, 211, 153, 0.16);
	color: #6ee7b7;
	font-weight: 800;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.25s ease, transform 0.25s ease;
}
.tta-saved:empty { display: none; }
.tta-saved svg { width: 15px; height: 15px; }
.tta-saved-show { opacity: 1; transform: none; }
html[data-a11y-contrast] .tta-saved { background: var(--a-bg); color: var(--a-ink); border: 2px solid var(--a-line); }

/* Phones: bottom sheet. */
@media (max-width: 640px) {
	.tta-sheet {
		top: auto;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		max-height: 92vh;
		max-height: 92dvh;
		border-radius: 30px 30px 0 0;
		border-bottom: 0;
		padding-bottom: env(safe-area-inset-bottom, 0px);
		transform: translateY(60px);
	}
	.tta-head { padding: 22px 18px 18px; }
	.tta-body { padding: 18px 18px 4px; gap: 22px; }
	.tta-foot { padding: 10px 18px 14px; }
	.tta-title { font-size: 26px; }
	.tta-keys { display: none; }
	.tta-tile-sub { display: none; }
	.tta-mini { height: 62px; padding: 9px; gap: 5px; }
	.tta-mini u { height: 11px; margin-top: 2px; }
}

@media (prefers-reduced-motion: reduce) {
	.tta-sheet, .tta-scrim, .tta-dock, .tta-fab::before, .tta-aurora i, .tta-preset, .tta-nest {
		animation: none !important;
		transition-duration: 0.01ms !important;
	}
}

/* ============================================================
   10. Settings page entry (settings.templ #st-accessibility)
   ============================================================ */

.tta-st {
	position: relative;
	display: flex;
	align-items: center;
	gap: 18px;
	width: 100%;
	padding: 20px 22px;
	border: 0;
	border-radius: 22px;
	overflow: hidden;
	isolation: isolate;
	background: linear-gradient(135deg, #1a1446 0%, #10173a 60%, #0b1026 100%);
	color: #fff;
	text-align: left;
	cursor: pointer;
	transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.4, 1), box-shadow 0.22s ease;
	box-shadow: 0 18px 40px -22px rgba(124, 92, 255, 0.8);
}
.tta-st:hover { transform: translateY(-3px); box-shadow: 0 24px 46px -22px rgba(124, 92, 255, 0.95); }
.tta-st::before,
.tta-st::after {
	content: "";
	position: absolute;
	z-index: -1;
	width: 220px;
	height: 220px;
	border-radius: 50%;
	filter: blur(56px);
}
.tta-st::before { top: -120px; left: -50px; background: #7c5cff; opacity: 0.8; }
.tta-st::after { bottom: -150px; right: -40px; background: #22d3ee; opacity: 0.5; }
.tta-st-icon {
	flex: none;
	width: 62px;
	height: 62px;
	border-radius: 20px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #7c5cff, #22d3ee);
	box-shadow: 0 10px 24px -10px #7c5cff;
}
.tta-st-icon svg { width: 36px; height: 36px; }
.tta-st-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tta-st-text strong { font-size: 1.15rem; font-weight: 800; color: #fff; }
.tta-st-text small { font-size: 0.9rem; line-height: 1.45; color: #c5cbe6; }
.tta-st-state {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	max-width: 46%;
	padding: 8px 14px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	background: rgba(255, 255, 255, 0.1);
	font-size: 0.82rem;
	font-weight: 800;
	color: #fff;
}
.tta-st-state::before {
	content: "";
	flex: none;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #7f89ad;
}
.tta-st[data-a11y-state="on"] .tta-st-state::before { background: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.25); }
.tta-st-feats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 10px;
	margin-top: 14px;
}
.tta-st-feat {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	border-radius: 16px;
	border: 1px solid rgba(100, 116, 139, 0.22);
	font-size: 0.88rem;
	font-weight: 600;
}
.tta-st-feat i { color: #7c5cff; font-size: 1.05rem; width: 20px; text-align: center; }
html[data-a11y-contrast="night"] .tta-st { background: #000; box-shadow: inset 0 0 0 2px #fff; }
html[data-a11y-contrast="night"] .tta-st-icon { background: #ffd60a; color: #000; box-shadow: none; }
html[data-a11y-contrast="night"] .tta-st-feat { border-color: #fff; }
html[data-a11y-contrast="night"] .tta-st-feat i { color: #ffd60a; }
html[data-a11y-contrast] .tta-st::before,
html[data-a11y-contrast] .tta-st::after { display: none; }

@media (max-width: 560px) {
	.tta-st { flex-wrap: wrap; }
	.tta-st-state { max-width: 100%; }
}

html[data-a11y-contrast="day"] .page-content { background: #fff !important; }
