/* Keep keyboard choice and fold control together at both dock heights. */
body:not(.exercise-open) #wt28-keyboard-picker{display:none!important}
body.exercise-open #wt28-keyboard-picker{transition:bottom 300ms cubic-bezier(.2,.75,.2,1),background .2s,color .2s!important}
/* Latin glyphs should be typographically contiguous; the old 9px spacing per
   character is excessive and magnifies spurious shaping controls. */
body.exercise-open .exercise-container>h2>span{margin-inline:0 2px!important;letter-spacing:normal!important}
/* Dark keycaps: override legacy !important colors in every semantic state. */
html[data-wt-public-theme="dark"] body.exercise-open .exercise-keyboard .key-container:not(.key-warning){background:#26364d!important;border-color:#536780!important;color:#f1f5ff!important}
html[data-wt-public-theme="dark"] body.exercise-open .exercise-keyboard .key-container:not(.key-warning) :is(span,small,p){color:#f1f5ff!important}
html[data-wt-public-theme="dark"] body.exercise-open .exercise-keyboard .key-container.key-warning{background:#ad3945!important;border-color:#ff9da4!important;color:#fff!important}
html[data-wt-public-theme="dark"] body.exercise-open .exercise-keyboard .key-container.key-warning :is(span,small,p){color:#fff!important}
html[data-wt-public-theme="dark"] body.exercise-open .exercise-keyboard .key-container .key-highlight{border:2px solid #ffdc70!important;box-shadow:inset 0 0 0 1px #f6db83,0 0 0 1px rgba(255,220,112,.4)!important;border-radius:5px}
html[data-wt-public-theme="dark"] body.exercise-open .exercise-keyboard .key-container:has(>.key-highlight){background:#4e4650!important;color:#fff!important}
html[data-wt-public-theme="dark"] body.exercise-open .exercise-keyboard .key-container:has(>.key-highlight) :is(span,small,p){color:#fff!important}
body.exercise-open .wt25-retry{gap:6px}
body.exercise-open .wt25-retry:disabled{opacity:.55;cursor:wait}
@media(max-width:700px){body.exercise-open .wt25-retry span{display:none!important}}

/* 1.5.26.26: highlighted keycap AND all nested labels must be themed together.
   The highlight overlay is a border; the actual background is the parent. */
html[data-wt-public-theme="dark"] body.exercise-open .keyboard.exercise-keyboard .key-container:not(.key-warning):has(>.key-highlight),
html[data-wt-public-theme="dark"] body.exercise-open .keyboard.exercise-keyboard[data-wetype-live-keyboard] .key-container:not(.key-warning):has(>.key-highlight){
  background:#f7cf7c!important;border-color:#f1bb53!important;color:#1c293a!important;
  box-shadow:0 0 0 2px rgba(247,207,124,.25)!important;
}
html[data-wt-public-theme="dark"] body.exercise-open .keyboard.exercise-keyboard .key-container:not(.key-warning):has(>.key-highlight) :is(strong,b,span,small,p,.key-label,.wetype-live-label),
html[data-wt-public-theme="dark"] body.exercise-open .keyboard.exercise-keyboard[data-wetype-live-keyboard] .key-container:not(.key-warning):has(>.key-highlight) :is(strong,b,span,small,p,.key-label,.wetype-live-label){color:#1c293a!important}
html[data-wt-public-theme="dark"] body.exercise-open .keyboard.exercise-keyboard .key-container:not(.key-warning)>.key-highlight{background:transparent!important;border:2px solid #ffe2a4!important;pointer-events:none}
html[data-wt-public-theme="dark"] body.exercise-open .keyboard.exercise-keyboard .key-container.key-warning :is(strong,b,span,small,p,.key-label,.wetype-live-label){color:#fff!important}

body.exercise-open .exercise-container>h2>span.wt26-latin-glyph{margin-left:0!important;margin-right:0!important;letter-spacing:normal!important}

/* 1.5.26.31 — ONE insertion cursor contract for both writing directions.
   Real compiled runtime moves .totype (Persian) or .totype_ltr (Latin/num)
   to the next character span. There must be no second independent cursor
   implementation or animated glyph border.  The pseudo-element is absolute,
   keeping text shaping and inline layout untouched when the active span moves.
   The separate .totype_left class only identifies Latin glyphs, NOT the caret. */
body.exercise-open .exercise-modal .exercise-container > h2 > span.totype_left {
  border-left: 0 !important;
  border-right: 0 !important;
}
body.exercise-open .exercise-modal .exercise-container > h2 > span:is(.totype, .totype_ltr) {
  border-left: 0 !important;
  border-right: 0 !important;
  position: relative;
  animation: none !important; /* disable old 'c' / 'c_left' animated borders */
}
/* One shared neon cursor, 1.5px × 1.92em, matching timing for both scripts. */
body.exercise-open .exercise-modal .exercise-container > h2 > span:is(.totype, .totype_ltr)::after {
  content: "";
  display: block;
  position: absolute;
  top: 50%;
  width: 1.5px;
  height: 1.92em;
  padding: 0;
  border: 0;
  border-radius: 3px;
  box-shadow: 0 0 4px rgba(33,184,255,.95), 0 0 11px rgba(0,137,255,.6);
  background-color: #28c5ff;
  transform: translateY(-50%);
  opacity: 1;
  pointer-events: none;
  z-index: 3;
  animation: wt32-smooth-neon-caret 1.2s ease-in-out infinite !important;
}
/* Only placement differs, as in the original right/left border-based cursor. */
body.exercise-open .exercise-modal .exercise-container > h2 > span.totype::after {
  right: -1px;
  left: auto;
}
body.exercise-open .exercise-modal .exercise-container > h2 > span.totype_ltr::after {
  left: -1px;
  right: auto;
}
html[data-wt-public-theme="dark"] body.exercise-open .exercise-modal .exercise-container > h2 > span:is(.totype, .totype_ltr)::after {
  background-color: #54d6ff;
  box-shadow: 0 0 5px rgba(83,217,255,.98), 0 0 13px rgba(19,144,255,.86), 0 0 20px rgba(0,107,255,.4);
}
@keyframes wt32-smooth-neon-caret {
  0%, 100% { opacity: .98; }
  42%, 55% { opacity: .14; }
}
@media (prefers-reduced-motion: reduce) {
  body.exercise-open .exercise-modal .exercise-container > h2 > span:is(.totype, .totype_ltr)::after {
    animation: none !important;
    opacity: 1 !important;
  }
}

/* 1.5.26.32: the picker and fold button use ONE actual keyboard top.
   Body-scoped height is updated from the fitted keyboard render bounds. */
body.exercise-open #wt28-keyboard-picker {
  bottom: calc(var(--wt-kb-height,245px) + 6px);
  transition: bottom 300ms cubic-bezier(.2,.75,.2,1), background .2s, color .2s!important;
}
body.exercise-open.wt-ex-keyboard-hidden #wt28-keyboard-picker {bottom:0}
/* Do not clip tall neon caret on the current glyph. */
body.exercise-open .exercise-modal .exercise-container > h2 {overflow:visible}

/* 1.5.26.33: paired picker dock has a shared bottom and shared scale.
   Horizontal position is measured from the scaled folding control. */
body.exercise-open #wt28-keyboard-picker {
  bottom: calc(var(--wt-kb-edge-bottom,245px) + 4px)!important;
  transform: scale(var(--wt-kb-ui-scale,1))!important;
  transform-origin: left bottom!important;
  transition: background-color .2s, color .2s!important;
}
body.exercise-open.wt-ex-keyboard-hidden #wt28-keyboard-picker {
  bottom:var(--wt-kb-edge-bottom,0px)!important;
}
/* Progress remains inside its native modal layout; only its geometry follows
   the visual keyboard width, not the original fixed 680px size while zoomed. */
body.exercise-open .exercise-modal .exercise-container .wt-exercise-progress {
  width: min(calc(100% - 24px), var(--wt-progress-width,680px))!important;
  max-width: calc(100vw - 28px)!important;
  gap:calc(14px * var(--wt-progress-ui-scale,1))!important;
  margin-top:calc(13px * var(--wt-progress-ui-scale,1))!important;
  margin-bottom:calc(24px * var(--wt-progress-ui-scale,1))!important;
}
body.exercise-open .exercise-modal .exercise-container .wt-exercise-progress__track {
  height:calc(8px * var(--wt-progress-ui-scale,1))!important;
}
body.exercise-open .exercise-modal .exercise-container .wt-exercise-progress__value {
  font-size:calc(13px * var(--wt-progress-ui-scale,1))!important;
  min-width:calc(48px * var(--wt-progress-ui-scale,1))!important;
}
body.exercise-open .exercise-modal .exercise-container .progress-title {
  font-size:calc(13px * var(--wt-progress-ui-scale,1))!important;
}
