/**
 * QNB Accessibility Widget
 * Page effects + floating menu UI (shared across EN/AR)
 * Fonts match site: EN = Helvetica/Arial, AR = Cairo / QNBSansAR
 * Sizes use px so they stay readable under the site's html{font-size:10px}
 */

:root {
  --a11y-red: #870052;
  --a11y-red-dark: #5c0038;
  --a11y-ink: #101418;
  --a11y-ink-soft: #4A5158;
  --a11y-paper: #FFFFFF;
  --a11y-paper-soft: #F4F5F7;
  --a11y-line: #E3E5E8;
  --a11y-focus: #1a73e8;
  --a11y-soft: #F9F0F5;
  --a11y-font-en: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --a11y-font-ar: Cairo, "QNBSansAR", Tahoma, Arial, sans-serif;
  --a11y-ui-size: 15px;
  --scale: 1;
  --tracking: 0em;
  --leading: 1;
  --sat: 1;
  --contrastv: 1;
  --invert: 0;
  --brightness: 1;
  --ls: 0.06em;
  --ws: 0.15em;
  --align: start;
}

/* ---- Page visual root (filters/zoom on site .wrapper; widget stays clear) ---- */
#a11yPageRoot,
.a11y-page-root {
  /* keep layout from .wrapper */
}

#a11yPageRoot.a11y-filter-on,
.a11y-page-root.a11y-filter-on {
  filter: saturate(var(--sat)) contrast(var(--contrastv)) brightness(var(--brightness)) invert(var(--invert)) hue-rotate(calc(var(--invert) * 180deg));
}

#a11yPageRoot.a11y-zoom-on,
.a11y-page-root.a11y-zoom-on {
  zoom: var(--scale);
}

/* Fallback root if a page has no body > .wrapper */
body > .a11y-page-root-fallback {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
}

html.a11y-dark-contrast,
html.a11y-dark-contrast body {
  --a11y-paper: #15171a;
  --a11y-paper-soft: #1b1e22;
  --a11y-ink: #F2F3F5;
  --a11y-ink-soft: #B9BEC4;
  --a11y-line: #2b2f34;
}

/* Dark contrast: real page darkening via invert (site uses many fixed colors) */
#a11yPageRoot.a11y-contrast-dark {
  filter: invert(1) hue-rotate(180deg) saturate(var(--sat)) !important;
  background-color: #111 !important;
}

#a11yPageRoot.a11y-contrast-dark img,
#a11yPageRoot.a11y-contrast-dark video,
#a11yPageRoot.a11y-contrast-dark picture,
#a11yPageRoot.a11y-contrast-dark embed,
#a11yPageRoot.a11y-contrast-dark object,
#a11yPageRoot.a11y-contrast-dark iframe:not([data-a11y-synced]) {
  filter: invert(1) hue-rotate(180deg) !important;
}

/* Same-origin content iframes (e.g. fra-part) keep parent contrast/filters */
#a11yPageRoot.a11y-contrast-dark iframe[data-a11y-synced] {
  filter: none !important;
}

/* Light contrast: stronger contrast boost so it is clearly visible */
#a11yPageRoot.a11y-contrast-light {
  filter: contrast(var(--contrastv)) brightness(var(--brightness)) saturate(var(--sat)) !important;
}

html.a11y-light-contrast #a11yPageRoot p,
html.a11y-light-contrast #a11yPageRoot li,
html.a11y-light-contrast #a11yPageRoot td,
html.a11y-light-contrast #a11yPageRoot th,
html.a11y-light-contrast #a11yPageRoot label,
html.a11y-light-contrast #a11yPageRoot span,
html.a11y-light-contrast #a11yPageRoot a,
html.a11y-light-contrast #a11yPageRoot h1,
html.a11y-light-contrast #a11yPageRoot h2,
html.a11y-light-contrast #a11yPageRoot h3,
html.a11y-light-contrast #a11yPageRoot h4,
html.a11y-light-contrast #a11yPageRoot h5,
html.a11y-light-contrast #a11yPageRoot h6 {
  color: #000 !important;
  text-shadow: 0 0 0.01px #000;
}

html.a11y-light-contrast #a11yPageRoot a {
  text-decoration: underline !important;
  text-decoration-thickness: 1.5px;
}

body.a11y-leading-on #a11yPageRoot *:not(i):not([class*="icon"]):not([class*="Icon"]):not(.fa):not([class^="icon-"]),
body.a11y-leading-on #a11yPageRoot {
  line-height: var(--leading) !important;
}

/* Bold text — 3 levels */
body.a11y-bold-1 #a11yPageRoot :not(i):not([class*="icon"]):not([class*="Icon"]):not(.fa):not([class^="icon-"]),
body.a11y-bold-1 #a11yPageRoot {
  font-weight: 600 !important;
}

body.a11y-bold-2 #a11yPageRoot :not(i):not([class*="icon"]):not([class*="Icon"]):not(.fa):not([class^="icon-"]),
body.a11y-bold-2 #a11yPageRoot {
  font-weight: 700 !important;
}

body.a11y-bold-3 #a11yPageRoot :not(i):not([class*="icon"]):not([class*="Icon"]):not(.fa):not([class^="icon-"]),
body.a11y-bold-3 #a11yPageRoot {
  font-weight: 800 !important;
  -webkit-text-stroke: 0.35px currentColor;
}

body.a11y-spacing-on #a11yPageRoot,
body.a11y-spacing-on #a11yPageRoot :not(i):not([class*="icon"]):not([class*="Icon"]):not(.fa):not([class^="icon-"]) {
  letter-spacing: var(--ls) !important;
  word-spacing: var(--ws) !important;
}

body.a11y-dyslexia-on #a11yPageRoot,
body.a11y-dyslexia-on #a11yPageRoot :not(i):not([class*="icon"]):not([class*="Icon"]):not(.fa):not([class^="icon-"]) {
  font-family: 'Comic Sans MS', Verdana, Arial, sans-serif !important;
}

body.a11y-hide-images #a11yPageRoot img,
body.a11y-hide-images #a11yPageRoot picture,
body.a11y-hide-images #a11yPageRoot svg.demo-photo {
  visibility: hidden !important;
}

body.a11y-pause-anim #a11yPageRoot *,
body.a11y-pause-anim #a11yPageRoot {
  animation-play-state: paused !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

body.a11y-align-force #a11yPageRoot p,
body.a11y-align-force #a11yPageRoot h1,
body.a11y-align-force #a11yPageRoot h2,
body.a11y-align-force #a11yPageRoot h3,
body.a11y-align-force #a11yPageRoot h4,
body.a11y-align-force #a11yPageRoot h5,
body.a11y-align-force #a11yPageRoot h6,
body.a11y-align-force #a11yPageRoot li,
body.a11y-align-force #a11yPageRoot td,
body.a11y-align-force #a11yPageRoot th,
body.a11y-align-force #a11yPageRoot label,
body.a11y-align-force #a11yPageRoot .banner-text-title,
body.a11y-align-force #a11yPageRoot .text_type_2,
body.a11y-align-force #a11yPageRoot .carousel-text-title,
body.a11y-align-force #a11yPageRoot .carousel-text-desc,
body.a11y-align-force #a11yPageRoot .carousel-text,
body.a11y-align-force #a11yPageRoot .section-2,
body.a11y-align-force #a11yPageRoot .section-3,
body.a11y-align-force #a11yPageRoot .section-4,
body.a11y-align-force #a11yPageRoot .footer-nav a,
body.a11y-align-force #a11yPageRoot .footer-title,
body.a11y-align-force #a11yPageRoot article,
body.a11y-align-force #a11yPageRoot .content p,
body.a11y-align-force #a11yPageRoot [class*="banner-text"] {
  text-align: var(--align) !important;
}

body.a11y-highlight-links #a11yPageRoot a {
  background: #FFF2B2 !important;
  color: #111 !important;
  text-decoration: underline !important;
  text-decoration-thickness: 2px;
  outline: 2px solid #E6B800;
  padding: 0 2px;
  border-radius: 3px;
}

body.a11y-big-cursor,
body.a11y-big-cursor * {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path d="M3 2l6.5 18 2-7.5L19 10.5z" fill="black" stroke="white" stroke-width="1"/></svg>') 2 2, auto !important;
}

#readingMaskBar {
  position: fixed;
  left: 0;
  right: 0;
  height: 52px;
  z-index: 2147483000;
  pointer-events: none;
  display: none;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.35);
}

body.a11y-reading-mask #readingMaskBar {
  display: block;
}

#readingLineBar {
  position: fixed;
  left: 0;
  top: 0;
  width: 420px;
  height: 28px;
  z-index: 2147483000;
  pointer-events: none;
  display: none;
  transform: translate(-50%, -55%);
  line-height: 0;
  background: none;
  border: none;
  box-shadow: none;
}

#readingLineBar .rl-shape {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

body.a11y-reading-line #readingLineBar {
  display: block;
}

@media (max-width: 640px) {
  #readingLineBar {
    width: 300px;
    height: 24px;
  }
}

body.a11y-sr-hoverable #a11yPageRoot [data-readable]:hover,
body.a11y-sr-hoverable #a11yPageRoot a:hover,
body.a11y-sr-hoverable #a11yPageRoot button:hover,
body.a11y-sr-hoverable #a11yPageRoot p:hover,
body.a11y-sr-hoverable #a11yPageRoot h1:hover,
body.a11y-sr-hoverable #a11yPageRoot h2:hover,
body.a11y-sr-hoverable #a11yPageRoot h3:hover,
body.a11y-sr-hoverable #a11yPageRoot li:hover,
body.a11y-sr-hoverable #a11yPageRoot label:hover {
  outline: 2px dashed var(--a11y-red);
  outline-offset: 2px;
  cursor: pointer;
}

/* ================= WIDGET UI ================= */
#a11yToggleBtn {
  position: fixed;
  bottom: 24px;
  inset-inline-start: 24px;
  z-index: 9998;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--a11y-red);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  padding: 0;
}

#a11yToggleBtn:hover {
  transform: scale(1.06);
}

#a11yToggleBtn.open {
  transform: rotate(90deg);
}

#a11yToggleBtn .icn {
  position: absolute;
  width: 28px;
  height: 28px;
  transition: opacity 0.2s ease, transform 0.3s ease;
}

#a11yToggleBtn .icn-access {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

#a11yToggleBtn .icn-x {
  opacity: 0;
  transform: scale(0.5) rotate(-90deg);
}

#a11yToggleBtn.open .icn-access {
  opacity: 0;
  transform: scale(0.5) rotate(90deg);
}

#a11yToggleBtn.open .icn-x {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

#a11yBadge {
  position: absolute;
  bottom: -2px;
  inset-inline-end: -2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #2ECC71;
  border: 2px solid #fff;
  display: none;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transform: rotate(0deg) !important;
  animation: a11yBadgeIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#a11yToggleBtn.open #a11yBadge {
  display: none !important;
}

@keyframes a11yBadgeIn {
  from { transform: scale(0) !important; }
  to { transform: scale(1) !important; }
}

#a11yToggleBtn:focus-visible,
.a11y-card:focus-visible {
  outline: 3px solid var(--a11y-focus);
  outline-offset: 2px;
}

#a11yPanel {
  position: fixed;
  bottom: 24px;
  inset-inline-start: 24px;
  z-index: 9999;
  width: min(380px, 92vw);
  max-height: 88vh;
  background: var(--a11y-paper);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  transform-origin: bottom left;
  transform: scale(0.85) translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease;
  font-family: var(--a11y-font-en);
  font-size: var(--a11y-ui-size);
  line-height: 1.4;
  color: var(--a11y-ink);
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

html[dir="rtl"] #a11yPanel,
html[lang^="ar"] #a11yPanel {
  font-family: var(--a11y-font-ar);
  transform-origin: bottom right;
}

#a11yPanel *,
#a11yPanel *::before,
#a11yPanel *::after {
  box-sizing: border-box;
}

#a11yPanel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.a11y-header {
  background: var(--a11y-red);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: 16px 16px 0 0;
}

.a11y-langsel-wrap {
  position: relative;
}

.a11y-langsel {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
}

.a11y-langsel .chev {
  transition: transform 0.2s ease;
}

.a11y-langsel-wrap.open .a11y-langsel .chev {
  transform: rotate(180deg);
}

.a11y-lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-start: 0;
  min-width: 180px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 10005;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.a11y-langsel-wrap.open .a11y-lang-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.a11y-lang-menu .lang-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 9px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  color: var(--a11y-ink);
  text-align: start;
}

.a11y-lang-menu .lang-item:hover {
  background: var(--a11y-paper-soft);
}

.a11y-lang-menu .lang-item .li-code {
  font-weight: 800;
  font-size: 11px;
  color: var(--a11y-ink-soft);
  background: var(--a11y-paper-soft);
  border-radius: 5px;
  padding: 2px 6px;
  min-width: 26px;
  text-align: center;
}

.a11y-lang-menu .lang-item .li-name {
  flex: 1;
  font-weight: 600;
}

.a11y-lang-menu .lang-item .li-check {
  opacity: 0;
  color: var(--a11y-red);
  font-weight: 800;
}

.a11y-lang-menu .lang-item.current .li-check {
  opacity: 1;
}

.a11y-lang-menu .lang-item.current {
  background: var(--a11y-soft);
}

.a11y-title {
  font-weight: 700;
  font-size: 15px;
  flex: 1;
  text-align: center;
}

.a11y-close {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
}

.a11y-close svg {
  width: 18px;
  height: 18px;
}

.a11y-body {
  overflow-y: auto;
  padding: 14px;
  flex: 1;
}

.a11y-profiles-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--a11y-paper-soft);
  border: 1px solid var(--a11y-line);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  color: var(--a11y-ink);
  margin-bottom: 10px;
  font-family: inherit;
}

.a11y-features-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.a11y-profiles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-bottom: 0;
  padding: 0 10px;
  border-radius: 12px;
  background: var(--a11y-paper-soft);
  border: 1px solid transparent;
  transition: max-height 0.28s ease, opacity 0.22s ease, margin 0.28s ease, padding 0.28s ease, border-color 0.22s ease;
}

.a11y-profiles-grid.open {
  max-height: 640px;
  opacity: 1;
  margin-bottom: 14px;
  padding: 12px;
  border-color: var(--a11y-line);
}

.a11y-card {
  position: relative;
  background: var(--a11y-paper);
  border: 2px solid var(--a11y-line);
  border-radius: 12px;
  padding: 14px 10px 10px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--a11y-ink-soft);
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  font-family: inherit;
}

.a11y-card:active {
  transform: scale(0.96);
}

.a11y-card svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

.a11y-card:hover {
  border-color: #c9cdd2;
}

.a11y-card.active {
  border-color: var(--a11y-red);
  background: var(--a11y-soft);
  color: var(--a11y-red-dark);
}

.a11y-card .check {
  position: absolute;
  top: 6px;
  inset-inline-start: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid var(--a11y-red);
  color: var(--a11y-red);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}

.a11y-card.active .check {
  display: flex;
}

.a11y-card .info-dot {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #c9cdd2;
  font-size: 10px;
  color: #8b929a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: help;
}

.a11y-card .shortcut-tip {
  position: absolute;
  bottom: 100%;
  inset-inline-end: 0;
  margin-bottom: 6px;
  background: #1b1f24;
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 2;
}

.a11y-card .info-dot:hover + .shortcut-tip,
.a11y-card .info-dot:focus + .shortcut-tip {
  opacity: 1;
}

.a11y-dots {
  display: flex;
  gap: 3px;
  margin-top: 2px;
}

.a11y-dots span {
  width: 12px;
  height: 4px;
  border-radius: 2px;
  background: #dfe2e5;
}

.a11y-dots span.on {
  background: var(--a11y-red-dark);
}

.a11y-reset {
  width: 100%;
  background: var(--a11y-red);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  font-family: inherit;
}

.a11y-note {
  font-size: 11px;
  color: var(--a11y-ink-soft);
  text-align: center;
  padding: 12px 14px 16px;
  border-top: 1px solid var(--a11y-line);
  line-height: 1.5;
}

.a11y-note .ar-line {
  font-family: var(--a11y-font-ar);
  direction: rtl;
  display: block;
  margin-top: 4px;
}

/* language confirm */
#langConfirm {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 14, 0.55);
  z-index: 10002;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: var(--a11y-font-en);
  font-size: var(--a11y-ui-size);
}

html[dir="rtl"] #langConfirm,
html[lang^="ar"] #langConfirm {
  font-family: var(--a11y-font-ar);
}

#langConfirm.open {
  display: flex;
}

.lc-box {
  background: #fff;
  border-radius: 14px;
  max-width: 360px;
  width: 100%;
  padding: 22px;
  text-align: center;
  animation: a11yPop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: var(--a11y-ink);
}

@keyframes a11yPop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lc-box h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.lc-box p {
  color: var(--a11y-ink-soft);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 18px;
}

.lc-actions {
  display: flex;
  gap: 10px;
}

.lc-actions button {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.lc-confirm {
  background: var(--a11y-red);
  color: #fff;
}

.lc-cancel {
  background: var(--a11y-paper-soft);
  color: var(--a11y-ink);
  border: 1px solid var(--a11y-line) !important;
}

/* Speech Recognition modal */
#speechModal {
  position: fixed;
  top: 6vh;
  left: 50%;
  z-index: 10001;
  width: min(420px, 90vw);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%) scale(0.9) translateY(-10px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
  font-family: var(--a11y-font-en);
  font-size: var(--a11y-ui-size);
  color: var(--a11y-ink);
}

html[dir="rtl"] #speechModal,
html[lang^="ar"] #speechModal {
  font-family: var(--a11y-font-ar);
}

#speechModal.open {
  transform: translateX(-50%) scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.sp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--a11y-line);
}

.sp-header button {
  background: none;
  border: 1.5px solid var(--a11y-line);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--a11y-ink);
}

.sp-title {
  font-weight: 700;
  font-size: 15px;
}

.sp-body {
  padding: 14px 16px 18px;
  display: none;
}

#speechModal.expanded .sp-body {
  display: block;
}

.sp-info {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: #EAF3FE;
  color: #1b5fb0;
  border: 1px solid #BFDBFB;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.sp-info svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

#speechText {
  width: 100%;
  min-height: 110px;
  border: 1px solid var(--a11y-line);
  border-radius: 10px;
  background: var(--a11y-paper-soft);
  padding: 12px;
  font-family: inherit;
  font-size: 15px;
  resize: vertical;
}

.sp-mic-row {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

#speechMicBtn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: #eef0f2;
  color: var(--a11y-ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

#speechMicBtn.listening {
  background: var(--a11y-red);
  color: #fff;
  animation: a11yPulse 1.4s infinite;
}

@keyframes a11yPulse {
  0% { box-shadow: 0 0 0 0 rgba(135, 0, 82, 0.45); }
  70% { box-shadow: 0 0 0 14px rgba(135, 0, 82, 0); }
  100% { box-shadow: 0 0 0 0 rgba(135, 0, 82, 0); }
}

.sp-target-hint {
  text-align: center;
  font-size: 11px;
  color: var(--a11y-ink-soft);
  margin-top: 8px;
}

/* Sign Language Video modal */
#signVideoModal {
  position: fixed;
  top: 6vh;
  left: 50%;
  z-index: 10001;
  width: min(400px, 90vw);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%) scale(0.9) translateY(-10px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
  font-family: var(--a11y-font-en);
  font-size: var(--a11y-ui-size);
  color: var(--a11y-ink);
}

html[dir="rtl"] #signVideoModal,
html[lang^="ar"] #signVideoModal {
  font-family: var(--a11y-font-ar);
}

#signVideoModal.open {
  transform: translateX(-50%) scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

#signVideoBackdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(10, 12, 14, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

#signVideoBackdrop.on {
  opacity: 1;
  pointer-events: auto;
}

.sv-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--a11y-line);
}

.sv-header .sv-title {
  font-weight: 700;
  flex: 1;
}

.sv-header button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--a11y-ink);
}

.sv-stage {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(160deg, #870052, #1a1c1f);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sv-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sv-avatar svg {
  width: 52px;
  height: 52px;
  stroke: #fff;
}

.sv-caption {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 12px;
  text-align: center;
  padding: 6px 8px;
  border-radius: 6px;
}

.sv-footer {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.sv-footer .sv-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--a11y-ink-soft);
}

.sv-footer button {
  background: none;
  border: 1px solid var(--a11y-line);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  opacity: 0.4;
}

#signAvatar {
  position: fixed;
  z-index: 2147482990;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 12px 12px 10px;
  background: linear-gradient(165deg, #1c2129 0%, #0d1016 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  color: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  font-family: var(--a11y-font-en);
  font-size: var(--a11y-ui-size);
  pointer-events: none;
  overflow: hidden;
  width: 200px;
}

html[dir="rtl"] #signAvatar,
html[lang^="ar"] #signAvatar {
  font-family: var(--a11y-font-ar);
}

#signAvatar.on {
  display: flex;
}

#signAvatar.mode-fullpage {
  bottom: 96px;
  inset-inline-end: 24px;
}

#signAvatar.mode-textselection {
  position: fixed;
}

#signAvatar.is-done .sign-replay {
  opacity: 1;
}

#signHandCanvas {
  display: block;
  width: 156px;
  height: 156px;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 38%, #323b4d 0%, #141820 72%);
}

#signAvatar .sign-letter {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  min-width: 32px;
  height: 32px;
  padding: 0 7px;
  border-radius: 10px;
  background: var(--a11y-red);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  line-height: 32px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(135, 0, 82, 0.5);
}

#signAvatar .sign-letter:empty {
  display: none;
}

#signAvatar .sign-strip {
  display: flex;
  gap: 3px;
  max-width: 176px;
  overflow: hidden;
  justify-content: center;
  direction: inherit;
  min-height: 18px;
}

#signAvatar .sign-strip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  height: 18px;
  padding: 0 3px;
  border-radius: 4px;
  font-size: 11px;
  opacity: 0.35;
  background: rgba(255, 255, 255, 0.06);
}

#signAvatar .sign-strip span.on {
  opacity: 1;
  background: rgba(135, 0, 82, 0.85);
  font-weight: 700;
}

#signAvatar .sign-strip span.done {
  opacity: 0.55;
}

#signAvatar .sign-preview {
  max-width: 176px;
  padding: 0 4px;
  font-size: 11px;
  line-height: 1.35;
  opacity: 0.9;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#signAvatar .sign-progress {
  width: 160px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

#signAvatar .sign-progress span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #870052, #c43d8a);
  transition: width 0.25s ease;
}

#signAvatar .sign-status {
  font-size: 11px;
  opacity: 0.75;
  min-height: 14px;
  text-align: center;
}

#signAvatar .sign-actions {
  pointer-events: auto;
  min-height: 28px;
}

#signAvatar .sign-replay {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 0.2s, background 0.2s;
  font-family: inherit;
}

#signAvatar.is-done .sign-replay,
#signAvatar .sign-replay:focus-visible {
  opacity: 1;
  background: var(--a11y-red);
  border-color: transparent;
}

#signAvatar span#signAvatarLabel {
  font-size: 11px;
  opacity: 0.65;
}

#selectionTooltip {
  position: fixed;
  z-index: 2147482991;
  background: #1b1f24;
  color: #fff;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  max-width: 280px;
  text-align: center;
  display: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  font-family: var(--a11y-font-en);
}

html[dir="rtl"] #selectionTooltip,
html[lang^="ar"] #selectionTooltip {
  font-family: var(--a11y-font-ar);
}

#selectionTooltip.on {
  display: block;
}

#selectionTooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid #1b1f24;
}

#srStatus {
  position: fixed;
  top: 14px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 10003;
  display: none;
  font-weight: 600;
  max-width: 80vw;
  text-align: center;
  font-family: var(--a11y-font-en);
}

html[dir="rtl"] #srStatus,
html[lang^="ar"] #srStatus {
  font-family: var(--a11y-font-ar);
}

#srStatus.on {
  display: block;
}

@media (max-width: 640px) {
  #a11yPanel {
    width: 94vw;
  }

  #speechModal,
  #signVideoModal {
    width: 94vw;
    top: 3vh;
  }
}
