/* Readability layer for every modal. Theme objects stay sharp above the blurred page. */
.overlay,
#a1-overlay,
.wscan-overlay {
  --modal-reading-ink: #f2f5ff;
  --modal-reading-muted: #c4cbe0;
  --modal-reading-surface: rgba(4, 7, 21, .82);
}

.overlay.open {
  background: rgba(0, 0, 0, .54);
}

.modal {
  background-color: rgba(10, 12, 29, .87);
  -webkit-backdrop-filter: blur(14px) saturate(118%);
  backdrop-filter: blur(14px) saturate(118%);
}

.modal .m-head,
.modal .m-body,
.wscan-modal-inner {
  position: relative;
  z-index: 3;
}

.modal .m-head .mt,
.modal .m-head h2,
.modal .m-head h3,
.wscan-word {
  color: #fbfcff;
}

.modal .m-body,
.modal .passage,
.modal .a1-bubble,
.modal .a1-q,
.wscan-modal-inner {
  color: var(--modal-reading-ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.reading-page .modal[class*="theme-"] .passage {
  color: var(--modal-reading-ink);
  background:
    linear-gradient(145deg, rgba(3, 6, 19, .88), rgba(7, 10, 28, .79)),
    radial-gradient(80% 120% at 100% 0, var(--pl-soft), transparent 68%);
  border-color: var(--pl-edge);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .08),
    0 14px 34px rgba(0, 0, 0, .25),
    0 0 24px -18px var(--pl-glow);
}

.modal .passage p,
.modal .passage li,
.modal .a1-text,
.modal .wscan-def,
.modal .wscan-origin {
  color: inherit;
}

.modal .qt,
.modal .a1-qtext,
.modal .wscan-section h4,
.wscan-section h4 {
  color: #f8faff;
}

.modal .opt,
.modal .a1-opt {
  color: #edf1ff;
  background-color: rgba(4, 7, 20, .62);
  border-color: rgba(177, 190, 224, .2);
}

.modal .opt:hover,
.modal .a1-opt:not(:disabled):hover {
  color: #fff;
  background-color: rgba(13, 19, 42, .82);
}

.modal .muted,
.modal .wscan-cat,
.modal .wscan-pos,
.modal .wscan-example,
.wscan-cat,
.wscan-pos,
.wscan-example {
  color: var(--modal-reading-muted);
}

/* Backdrop blur never touches the theme decorations themselves. */
.modal .theme-decor,
.modal .theme-objects,
.modal .theme-decor *,
.modal .theme-objects * {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

@media (max-width: 720px) {
  .modal {
    -webkit-backdrop-filter: blur(13px) saturate(116%);
    backdrop-filter: blur(13px) saturate(116%);
  }

  .modal .m-body {
    padding-inline: 18px;
  }

  .reading-page .modal[class*="theme-"] .passage {
    padding: 18px;
    font-size: 17px;
    line-height: 1.84;
  }

  .modal .qt,
  .modal .a1-qtext {
    font-size: 16.5px;
    line-height: 1.5;
  }

  .modal .opt,
  .modal .a1-opt {
    line-height: 1.45;
  }
}

@media (max-width: 380px) {
  .modal .m-body {
    padding-inline: 15px;
  }

  .reading-page .modal[class*="theme-"] .passage {
    padding: 16px;
    font-size: 16.5px;
  }
}
