/* Lesson document editor v1 */

body.lesson-document-editor-open {
  overflow: hidden;
}

.lesson-document-editor-root {
  position: fixed;
  z-index: 10000;
  inset: 0;
  overflow: auto;
  background: #fff;
  color: #242424;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.lde-shell {
  min-height: 100vh;
}

.lde-topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: grid;
  grid-template-columns: 42px minmax(200px, 760px) auto;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 72px;
  padding: 10px 28px;
  border-bottom: 1px solid #eeeeee;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
}

.lde-back,
.lde-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #282828;
  font-size: 24px;
  cursor: pointer;
}

.lde-back:hover,
.lde-more:hover {
  background: #f4f4f4;
}

.lde-topbar-context {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lde-topbar-context strong {
  font-size: 15px;
}

.lde-topbar-context span {
  color: #929292;
  font-size: 12px;
}

.lde-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lde-action {
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.lde-action.secondary {
  border-color: #e5e5e5;
  background: #fff;
  color: #282828;
}

.lde-action.secondary:hover {
  background: #f7f7f7;
}

.lde-action.publish {
  background: #278248;
  color: #fff;
}

.lde-action.publish:hover {
  background: #206f3d;
}

.lde-document {
  width: min(100% - 40px, 760px);
  margin: 0 auto;
  padding: 70px 0 160px;
}

.lde-title {
  display: block;
  width: 100%;
  min-height: 58px;
  padding: 0;
  overflow: hidden;
  border: 0;
  outline: 0;
  background: transparent;
  color: #252525;
  font: inherit;
  font-size: clamp(38px, 4.2vw, 54px);
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: -0.045em;
  resize: none;
}

.lde-title::placeholder {
  color: #c4c4c4;
}

.lde-save-caption {
  min-height: 34px;
  padding-top: 8px;
  color: #9b9b9b;
  font-size: 12px;
}

.lde-blocks {
  display: grid;
}

.lde-block {
  position: relative;
  padding: 10px 0 18px;
}

.lde-block-content {
  min-width: 0;
}

.lde-text,
.lde-heading {
  min-height: 34px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #282828;
  font-size: 18px;
  line-height: 1.72;
}

.lde-heading {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.22;
}

.lde-text:empty::before,
.lde-heading:empty::before,
[data-document-caption]:empty::before {
  color: #b3b3b3;
  content: attr(data-placeholder);
  pointer-events: none;
}

.lde-text p {
  margin: 0 0 16px;
}

.lde-text h2,
.lde-text h3 {
  margin: 24px 0 12px;
  line-height: 1.25;
}

.lde-text ul,
.lde-text ol {
  padding-left: 28px;
}

.lde-text a {
  color: #1976d2;
}

.lde-quote {
  margin: 8px 0;
  padding-left: 24px;
  border-left: 3px solid #282828;
  font-size: 21px;
}

.lde-checklist {
  padding: 18px 20px;
  border-radius: 14px;
  background: #f6f7f6;
}

.lde-line-plus {
  position: absolute;
  top: 7px;
  right: calc(100% + 18px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid #dddddd;
  border-radius: 50%;
  background: #fff;
  color: #626262;
  font-size: 23px;
  font-weight: 300;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.14s ease;
}

.lde-block:hover .lde-line-plus,
.lde-block:focus-within .lde-line-plus {
  opacity: 1;
}

.lde-block-more {
  position: absolute;
  top: 7px;
  left: calc(100% + 12px);
  width: 38px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #999999;
  font-size: 17px;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.14s ease;
}

.lde-block:hover .lde-block-more,
.lde-block:focus-within .lde-block-more {
  opacity: 1;
}

.lde-block-more:hover {
  background: #f4f4f4;
  color: #333333;
}

.lde-block-actions {
  position: absolute;
  z-index: 35;
  top: 42px;
  left: calc(100% + 12px);
  display: grid;
  min-width: 190px;
  padding: 7px;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.13);
}

.lde-block-actions[hidden] {
  display: none;
}

.lde-block-actions button {
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #303030;
  text-align: left;
  cursor: pointer;
}

.lde-block-actions button:hover {
  background: #f4f4f4;
}

.lde-block-actions button.danger {
  color: #bd3535;
}

.lde-block-actions button:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.lde-image-block {
  margin: 14px 0;
}

.lde-image-block img {
  display: block;
  width: 100%;
  max-height: 720px;
  border-radius: 5px;
  object-fit: contain;
}

.lde-image-block figcaption,
.lde-media-caption {
  min-height: 28px;
  padding-top: 10px;
  outline: 0;
  color: #929292;
  font-size: 13px;
  text-align: center;
}

.lde-video-block iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 5px;
}

.lde-video-link,
.lde-empty-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 220px;
  border: 1px dashed #d7d7d7;
  border-radius: 12px;
  background: #fafafa;
  color: #4c4c4c;
  text-decoration: none;
  cursor: pointer;
}

.lde-file-block,
.lde-link-block {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid #e5e5e5;
  border-radius: 13px;
  background: #fafafa;
}

.lde-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 11px;
  background: #e9f3ec;
  color: #277a45;
  font-size: 11px;
  font-weight: 900;
}

.lde-file-copy,
.lde-link-block > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.lde-file-copy span,
.lde-link-block small {
  overflow: hidden;
  color: #868686;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lde-file-block a,
.lde-file-block button,
.lde-link-block button {
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: #fff;
  color: #287a46;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.lde-bottom-add {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #777777;
  cursor: pointer;
}

.lde-bottom-add span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #d7d7d7;
  border-radius: 50%;
  background: #fff;
  color: #555555;
  font-size: 23px;
  font-weight: 300;
}

.lde-bottom-add b {
  font-size: 13px;
}

.lde-format-toolbar {
  position: fixed;
  z-index: 10100;
  display: flex;
  gap: 2px;
  padding: 6px;
  border: 1px solid #e7e7e7;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18);
}

.lde-format-toolbar[hidden] {
  display: none;
}

.lde-format-toolbar button {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #303030;
  cursor: pointer;
}

.lde-format-toolbar button:hover {
  background: #f1f1f1;
}

.lde-insert-menu {
  position: fixed;
  z-index: 10120;
  display: grid;
  grid-template-columns: repeat(2, minmax(135px, 1fr));
  gap: 5px;
  width: 310px;
  padding: 8px;
  border: 1px solid #e7e7e7;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.16);
}

.lde-insert-menu[hidden] {
  display: none;
}

.lde-insert-menu button {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 9px;
  min-height: 45px;
  padding: 6px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #303030;
  text-align: left;
  cursor: pointer;
}

.lde-insert-menu button:hover {
  background: #f4f5f4;
}

.lde-insert-menu span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #edf4ef;
  color: #287b46;
  font-size: 12px;
  font-weight: 850;
}

.lde-dialog,
.lde-preview {
  position: fixed;
  z-index: 10200;
  inset: 0;
}

.lde-dialog[hidden],
.lde-preview[hidden] {
  display: none;
}

.lde-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 22, 22, 0.66);
  backdrop-filter: blur(3px);
}

.lde-dialog-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  width: min(92vw, 560px);
  margin: min(10vh, 80px) auto 0;
  padding: 30px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.3);
}

.lde-dialog-card h2 {
  margin: 0;
  text-align: center;
}

.lde-dialog-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: transparent;
  color: #777777;
  font-size: 30px;
  cursor: pointer;
}

.lde-upload-zone {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 38px 20px;
  border: 2px dashed #d7d7d7;
  border-radius: 16px;
  background: #fafafa;
  text-align: center;
}

.lde-upload-zone.dragging {
  border-color: #278248;
  background: #f0f8f2;
}

.lde-upload-zone input {
  max-width: 100%;
}

.lde-dialog-or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #999999;
  font-size: 12px;
}

.lde-dialog-or::before,
.lde-dialog-or::after {
  flex: 1;
  height: 1px;
  background: #e5e5e5;
  content: "";
}

.lde-dialog-field {
  display: grid;
  gap: 7px;
}

.lde-dialog-field span {
  font-size: 13px;
  font-weight: 750;
}

.lde-dialog-field input {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #dddddd;
  border-radius: 10px;
  font: inherit;
}

.lde-dialog-submit {
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  background: #278248;
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.lde-dialog-submit:disabled {
  opacity: 0.65;
}

.lde-preview {
  overflow: auto;
  background: #fff;
}

.lde-preview header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 70px;
  padding: 10px 28px;
  border-bottom: 1px solid #eeeeee;
  background: rgba(255, 255, 255, 0.97);
}

.lde-preview header button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.lde-preview article {
  width: min(100% - 40px, 760px);
  margin: 0 auto;
  padding: 70px 0 140px;
  font-size: 18px;
  line-height: 1.72;
}

.lde-preview article h1 {
  font-size: 48px;
  line-height: 1.1;
}

.lde-preview article img,
.lde-preview article iframe {
  display: block;
  width: 100%;
  margin: 30px 0;
  border: 0;
}

.lde-preview article iframe {
  aspect-ratio: 16 / 9;
}

.lde-preview article blockquote {
  margin: 26px 0;
  padding-left: 24px;
  border-left: 3px solid #282828;
}

@media (max-width: 900px) {
  .lde-topbar {
    grid-template-columns: 40px minmax(0, 1fr);
    justify-content: stretch;
    padding: 10px 16px;
  }

  .lde-topbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .lde-document {
    padding-top: 46px;
  }

  .lde-line-plus,
  .lde-block-more {
    position: static;
    margin: 0 6px 6px 0;
    opacity: 1;
  }

  .lde-block-actions {
    top: 44px;
    right: 0;
    left: auto;
  }
}

@media (max-width: 620px) {
  .lde-topbar-context strong {
    font-size: 13px;
  }

  .lde-topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .lde-topbar-actions .lde-more {
    width: 100%;
  }

  .lde-action {
    width: 100%;
  }

  .lde-document {
    width: min(100% - 30px, 760px);
  }

  .lde-title {
    font-size: 36px;
  }

  .lde-insert-menu {
    grid-template-columns: 1fr;
    width: min(310px, calc(100vw - 24px));
  }

  .lde-file-block,
  .lde-link-block {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .lde-file-block > :last-child,
  .lde-link-block > :last-child {
    grid-column: 1 / -1;
    width: 100%;
  }
}

body[data-theme="dark"] .lesson-document-editor-root,
body[data-theme="dark"] .lde-preview {
  background: #161916;
  color: #edf3ee;
}

body[data-theme="dark"] .lde-topbar,
body[data-theme="dark"] .lde-preview header {
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(22, 25, 22, 0.97);
}

body[data-theme="dark"] .lde-title,
body[data-theme="dark"] .lde-text,
body[data-theme="dark"] .lde-heading {
  color: #edf3ee;
}

body[data-theme="dark"] .lde-action.secondary,
body[data-theme="dark"] .lde-format-toolbar,
body[data-theme="dark"] .lde-insert-menu,
body[data-theme="dark"] .lde-block-actions,
body[data-theme="dark"] .lde-dialog-card {
  border-color: rgba(255, 255, 255, 0.11);
  background: #242924;
  color: #edf3ee;
}

body[data-theme="dark"] .lde-format-toolbar button,
body[data-theme="dark"] .lde-insert-menu button,
body[data-theme="dark"] .lde-block-actions button {
  color: #edf3ee;
}

body[data-theme="dark"] .lde-format-toolbar button:hover,
body[data-theme="dark"] .lde-insert-menu button:hover,
body[data-theme="dark"] .lde-block-actions button:hover {
  background: rgba(255, 255, 255, 0.07);
}

body[data-theme="dark"] .lde-checklist,
body[data-theme="dark"] .lde-file-block,
body[data-theme="dark"] .lde-link-block,
body[data-theme="dark"] .lde-upload-zone {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}


/* Direct lesson writing v2 */

.lde-continuation {
  min-height: 78px;
  padding: 12px 0 18px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #282828;
  font-size: 18px;
  line-height: 1.72;
  cursor: text;
}

.lde-continuation:empty::before {
  color: #b2b2b2;
  content: attr(data-placeholder);
  pointer-events: none;
}

.lde-continuation:focus:empty::before {
  color: #c5c5c5;
}

.lde-continuation:hover {
  background:
    linear-gradient(
      90deg,
      rgba(39, 130, 72, 0.035),
      transparent 70%
    );
}

body[data-theme="dark"] .lde-continuation {
  color: #edf3ee;
}

body[data-theme="dark"]
.lde-continuation:empty::before {
  color: #7f8881;
}


/* Empty document like article editor v3 */

.lde-empty-writing-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 70px;
}

.lde-empty-image-button {
  position: absolute;
  top: 8px;
  right: calc(100% + 12px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #a8a8a8;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.lde-empty-image-button:hover,
.lde-empty-image-button:focus-visible {
  background: #f1f1f1;
  color: #404040;
  outline: 0;
}

.lde-continuation {
  min-height: 54px;
  padding: 7px 0 20px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #282828;
  font-size: 18px;
  line-height: 1.72;
  cursor: text;
}

.lde-continuation:empty::before {
  color: #c5c5c5;
  content: attr(data-placeholder);
  pointer-events: none;
}

.lde-continuation:hover {
  background: transparent;
}

.lde-bottom-add {
  display: none !important;
}

body[data-theme="dark"] .lde-empty-image-button {
  color: #6f786f;
}

body[data-theme="dark"] .lde-empty-image-button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #e5ece6;
}

body[data-theme="dark"] .lde-continuation {
  color: #edf3ee;
}

body[data-theme="dark"] .lde-continuation:empty::before {
  color: #727a73;
}

@media (max-width: 900px) {
  .lde-empty-image-button {
    position: static;
    margin-bottom: 4px;
  }

  .lde-empty-writing-row {
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
  }
}

/* Empty writing row without image square v1 */

.lde-empty-writing-row.lde-empty-writing-row-clean {
  display: block;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

.lde-empty-writing-row-clean .lde-continuation {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding-left: 0;
}

/* End empty writing row without image square v1 */
