.guide-share-list button.copied {
  border-color: rgba(80, 206, 158, 0.55) !important;
  background: rgba(24, 89, 68, 0.7) !important;
  color: #8ce7c2 !important;
}

/* Search is one compound control: the input must not draw a second surface. */
.guide-page .guide-search {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  padding: 0 13px;
}

.guide-page .guide-search > svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.guide-page .guide-search > input {
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0;
  background: transparent !important;
  box-shadow: none !important;
}

.guide-page .guide-search:focus-within {
  border-color: rgba(58, 169, 233, 0.85);
  box-shadow: 0 0 0 3px rgba(33, 150, 217, 0.15);
}

.guide-page-group {
  margin: 17px 0;
}

.guide-page-button .guide-drag-grip {
  width: 17px;
  flex: 0 0 17px;
  display: grid;
  place-items: center;
  margin-left: -3px;
  color: #667f96;
  font-size: 15px;
  line-height: 1;
  cursor: grab;
  user-select: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.guide-page-button:hover .guide-drag-grip {
  color: #8ed5fa;
}

.guide-page-button .guide-drag-grip:active {
  cursor: grabbing;
}

.guide-page-button > span:not(.guide-drag-grip) {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-page-button.dragging {
  opacity: 0.38;
}

.guide-page-button.drag-over {
  background: rgba(35, 103, 145, 0.52) !important;
  box-shadow: inset 0 0 0 1px rgba(93, 198, 250, 0.5);
}

.guide-page-drop-zone {
  width: 100%;
  min-height: 30px;
  margin-top: 4px;
  border: 1px dashed rgba(94, 151, 193, 0.34) !important;
  border-radius: 8px !important;
  background: rgba(8, 23, 36, 0.35) !important;
  color: #718ba2 !important;
  font-size: 10px;
  cursor: grabbing;
}

.guide-page-drop-zone.active {
  border-color: rgba(93, 198, 250, 0.72) !important;
  background: rgba(31, 92, 128, 0.45) !important;
  color: #9edfff !important;
}

.guide-page-ungrouped:empty {
  display: none;
}

.local-access-enabled-toggle,
.legacy-permission-grid {
  display: none !important;
}

.section-access-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.section-access-heading {
  display: grid;
  gap: 4px;
  margin-top: 16px;
}

.section-access-heading b {
  color: #dce8f4;
  font-size: 13px;
}

.section-access-heading p {
  margin: 0;
  color: #7f93a8;
  font-size: 11px;
  line-height: 1.5;
}

.section-access-card {
  min-width: 0;
  min-height: 92px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(88, 132, 176, 0.24);
  border-radius: 14px;
  background: rgba(8, 23, 37, 0.72);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.section-access-card:hover {
  border-color: rgba(87, 177, 229, 0.46);
  background: rgba(13, 39, 59, 0.78);
}

.section-access-card.active {
  border-color: rgba(71, 185, 239, 0.58);
  background: linear-gradient(
    135deg,
    rgba(24, 83, 117, 0.68),
    rgba(25, 51, 86, 0.62)
  );
  box-shadow: inset 0 0 0 1px rgba(105, 207, 255, 0.06);
}

.section-access-card > input {
  grid-column: 3;
  grid-row: 1;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #39aeea;
}

.section-access-card > input:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.section-access-icon {
  grid-column: 1;
  grid-row: 1;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(31, 85, 119, 0.55);
  color: #69cafa;
}

.section-access-icon.guides {
  background: rgba(67, 59, 137, 0.42);
  color: #a69bff;
}

.section-access-icon svg {
  width: 20px;
  height: 20px;
}

.section-access-card > span:last-child {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  display: grid;
  gap: 5px;
}

.section-access-card b {
  color: #e7f1fb;
  font-size: 13px;
}

.section-access-card small {
  color: #8297ad;
  font-size: 11px;
  line-height: 1.45;
}

.section-access-card.active small {
  color: #a1c4da;
}

@media (max-width: 720px) {
  .section-access-grid {
    grid-template-columns: 1fr;
  }
}

.guide-share-list button {
  min-width: 94px;
  min-height: 38px;
  padding: 8px 12px !important;
  border-radius: 9px !important;
  justify-content: center;
  font-size: 12px;
  font-weight: 750;
  overflow-wrap: normal;
  word-break: normal;
  white-space: nowrap;
}

.guide-share-list article code {
  display: block;
  max-width: 270px;
  margin-top: 5px;
  overflow: hidden;
  color: #67c7f6;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-share-list article > div button:first-child {
  border-color: rgba(74, 169, 225, 0.4);
  background: rgba(22, 76, 109, 0.62);
  color: #a9e1ff;
}

.guide-share-list article > div button:last-child {
  min-width: 82px;
  border-color: rgba(226, 105, 123, 0.3);
  background: rgba(83, 32, 43, 0.34);
  color: #ffacb7;
}

.guide-link-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.guide-link-mode > button {
  min-height: 62px;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 10px 13px !important;
  border-color: rgba(80, 124, 164, 0.32) !important;
  background: rgba(11, 27, 42, 0.72) !important;
  text-align: left;
}

.guide-link-mode > button small {
  color: #71889f;
  font-size: 11px;
  letter-spacing: 0;
}

.guide-link-mode > button.active {
  border-color: rgba(74, 181, 236, 0.62) !important;
  background: linear-gradient(
    135deg,
    rgba(28, 97, 136, 0.7),
    rgba(31, 62, 101, 0.66)
  ) !important;
  box-shadow: inset 0 0 0 1px rgba(98, 203, 255, 0.08);
}

.guide-link-mode > button.active b {
  color: #eaf7ff;
}

.guide-link-mode > button.active small {
  color: #98d9fb;
}

.guide-custom-link > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  overflow: hidden;
  border: 1px solid #354a62;
  border-radius: 10px;
  background: #0d1824;
}

.guide-custom-link > div:focus-within {
  border-color: #3aa9e9;
  box-shadow: 0 0 0 3px rgba(33, 150, 217, 0.15);
}

.guide-custom-link > div > span {
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 0 4px 0 13px;
  color: #6fc8f5;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 13px;
}

.guide-dialog .guide-custom-link input,
.guide-dialog .guide-custom-link input:focus {
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  padding: 12px 13px 12px 4px !important;
  box-shadow: none !important;
  font-family: "Cascadia Code", Consolas, monospace !important;
}

.guide-share-form input:-webkit-autofill,
.guide-share-form input:-webkit-autofill:hover,
.guide-share-form input:-webkit-autofill:focus,
.guide-share-form input:-webkit-autofill:active {
  -webkit-text-fill-color: #eef6ff !important;
  caret-color: #eef6ff;
  -webkit-box-shadow: 0 0 0 1000px #0d1824 inset !important;
  box-shadow: 0 0 0 1000px #0d1824 inset !important;
  transition: background-color 9999s ease-out 0s;
}

.guide-share-form input:autofill {
  background: #0d1824 !important;
  color: #eef6ff !important;
  box-shadow: 0 0 0 1000px #0d1824 inset !important;
}

.guide-custom-link > small {
  margin: 0 !important;
  color: #cfaa70 !important;
  font-size: 11px !important;
  line-height: 1.5;
  letter-spacing: 0 !important;
}

.guide-edit-address {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 13px;
  border: 1px solid rgba(79, 130, 174, 0.3);
  border-radius: 11px;
  background: rgba(8, 23, 36, 0.72);
}

.guide-edit-address > span {
  min-width: 0;
}

.guide-edit-address small,
.guide-edit-address code {
  display: block;
}

.guide-edit-address small {
  margin-bottom: 4px;
  color: #788da3;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-edit-address code {
  overflow: hidden;
  color: #72cef9;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-edit-address button {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .guide-link-mode {
    grid-template-columns: 1fr;
  }

  .guide-edit-address {
    align-items: stretch;
    flex-direction: column;
  }

  .guide-edit-address button {
    justify-content: center;
  }
}

.public-guide {
  grid-template-columns: 280px minmax(0, 1fr);
  background:
    radial-gradient(
      circle at 72% -10%,
      rgba(37, 112, 158, 0.14),
      transparent 32%
    ),
    #0b141f;
}

.public-guide > aside {
  padding: 0 18px 28px;
  background: rgba(13, 27, 40, 0.94);
  border-color: rgba(91, 135, 176, 0.26);
  transform: none;
  transition: none;
}

.public-guide > aside header {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 82px;
  justify-content: space-between;
  margin: 0 -18px 18px;
  padding: 18px;
  border-color: rgba(91, 135, 176, 0.24);
  background: rgba(10, 22, 34, 0.94);
  backdrop-filter: blur(12px);
}

.public-guide > aside header span {
  order: 1;
  flex: 1;
  min-width: 0;
}

.public-guide > aside header svg {
  order: 2;
  width: 30px;
  height: 30px;
  margin-left: 14px;
}

.public-guide > aside header small {
  margin-bottom: 4px;
  color: #55c4ff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.public-guide > aside header b {
  overflow: hidden;
  color: #eff6ff;
  font-size: 18px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.public-guide > aside section {
  margin-top: 24px;
}

.public-guide > aside h3 {
  margin: 0 8px 8px;
  font-size: 10px;
  letter-spacing: 0.13em;
}

.public-guide .guide-page-button {
  min-height: 38px;
  padding: 9px 10px !important;
  color: #aab9ca !important;
}

.public-guide .guide-page-button.active {
  background: linear-gradient(
    100deg,
    rgba(28, 82, 119, 0.78),
    rgba(39, 61, 91, 0.72)
  ) !important;
  color: #7bd2ff !important;
  box-shadow: inset 0 0 0 1px rgba(86, 184, 239, 0.12);
}

.public-guide > main {
  width: 100%;
  max-width: 1080px;
  justify-self: center;
  padding: clamp(42px, 6vw, 76px) clamp(34px, 4.5vw, 72px);
}

.public-guide > main > small {
  display: inline-flex;
  color: #55c4ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.public-guide > main > h1 {
  max-width: none;
  margin: 10px 0 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(91, 135, 176, 0.2);
  color: #f1f6fc;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.public-guide > main .guide-rich-content {
  max-width: none;
}

.public-guide > main .guide-rich-content:empty,
.public-guide > main .guide-rich-content:has(> p:only-child:empty) {
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px dashed rgba(91, 135, 176, 0.2);
  border-radius: 14px;
  background: rgba(15, 29, 43, 0.45);
  color: #8094aa;
  text-align: center;
}

.public-guide > main .guide-rich-content:empty::after,
.public-guide > main .guide-rich-content:has(> p:only-child:empty)::after {
  content: "На этой странице пока нет содержимого";
  padding: 24px;
}

.public-guide > main .guide-rich-content:has(> p:only-child:empty) > p {
  display: none;
}

@media (max-width: 800px) {
  .public-guide {
    display: block;
  }

  .public-guide > aside {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    max-height: none;
    padding: 0 14px 16px;
    overflow: visible;
    transform: none !important;
    transition: none !important;
  }

  .public-guide > aside header {
    position: static;
    grid-column: 1 / -1;
    min-height: 72px;
    margin: 0 -14px 2px;
    padding: 15px 18px;
  }

  .public-guide > aside header b {
    font-size: 17px;
  }

  .public-guide > aside header svg {
    width: 27px;
    height: 27px;
  }

  .public-guide > aside section {
    min-width: 0;
    margin: 0;
  }

  .public-guide > aside h3 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .public-guide .guide-page-button {
    min-height: 36px;
  }

  .public-guide > main {
    padding: 30px 20px 48px;
  }

  .public-guide > main > h1 {
    font-size: 30px;
  }
}

/* Shared guide editor and reader refinements. */
.guide-page-button {
  display: flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
}

.guide-version-button {
  position: relative;
  min-height: 38px;
  padding-left: 36px !important;
  border-color: rgba(87, 176, 231, 0.34) !important;
  background: linear-gradient(
    145deg,
    rgba(24, 76, 110, 0.56),
    rgba(34, 47, 74, 0.72)
  ) !important;
  color: #9edcff !important;
  box-shadow: inset 0 0 0 1px rgba(92, 191, 245, 0.06);
}

.guide-version-button::before {
  content: "";
  position: absolute;
  left: 13px;
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.guide-version-button::after {
  content: "";
  position: absolute;
  left: 19px;
  width: 4px;
  height: 4px;
  border-bottom: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
  transform: translate(-1px, -1px);
}

.guide-version-button:hover {
  border-color: rgba(98, 197, 249, 0.58) !important;
  background: linear-gradient(
    145deg,
    rgba(30, 101, 144, 0.65),
    rgba(48, 58, 94, 0.78)
  ) !important;
}

.guide-revisions {
  width: min(460px, calc(100% - 40px));
  padding: 0;
  overflow: hidden;
  border-color: rgba(92, 143, 190, 0.38);
  border-radius: 16px;
  background: rgba(12, 25, 38, 0.96);
  box-shadow: 0 28px 75px rgba(0, 5, 14, 0.72);
  backdrop-filter: blur(16px);
}

.guide-revisions header {
  min-height: 64px;
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid rgba(92, 143, 190, 0.24);
  background: linear-gradient(
    100deg,
    rgba(30, 83, 118, 0.26),
    rgba(17, 29, 45, 0.4)
  );
}

.guide-revisions header h3 {
  margin: 0;
  color: #eef6ff;
  font-size: 17px;
}

.guide-revisions > div {
  min-height: 66px;
  padding: 12px 16px;
  border-top: 0;
  border-bottom: 1px solid rgba(92, 143, 190, 0.16);
}

.guide-revisions > div:last-child {
  border-bottom: 0;
}

.guide-revisions > div:hover {
  background: rgba(39, 71, 101, 0.18);
}

.guide-revisions > div > svg {
  color: #69c6f8;
}

.guide-revisions > div button {
  min-height: 34px;
  padding: 7px 10px !important;
}

.guide-layout:has(.guide-editor) {
  grid-template-columns: minmax(0, 1fr);
  overflow: visible;
}

.guide-layout:has(.guide-editor) > .guide-library,
.guide-layout:has(.guide-editor) > .guide-tree {
  display: none;
}

.guide-document:has(.guide-editor) {
  padding: clamp(24px, 3vw, 46px);
  background:
    radial-gradient(circle at 88% 0, rgba(35, 102, 148, 0.18), transparent 30%),
    #0b1521;
}

.guide-editor {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(18px, 2.4vw, 30px);
  border: 1px solid rgba(91, 139, 184, 0.26);
  border-radius: 18px;
  background: linear-gradient(
    145deg,
    rgba(16, 32, 49, 0.94),
    rgba(9, 20, 32, 0.96)
  );
  box-shadow: 0 22px 70px rgba(0, 6, 16, 0.3);
}

.guide-editor .guide-title-input {
  min-height: 64px;
  margin-bottom: 18px;
  padding: 7px 2px 15px !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(91, 139, 184, 0.28) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: clamp(28px, 3vw, 38px) !important;
  font-weight: 780;
  line-height: 1.14;
  letter-spacing: -0.025em;
}

.guide-editor .guide-editor-meta {
  grid-template-columns: 180px 220px minmax(240px, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.guide-editor .guide-editor-meta input,
.guide-editor .guide-editor-meta select {
  min-height: 42px;
  border-color: rgba(91, 139, 184, 0.3);
  border-radius: 10px;
  background: rgba(8, 20, 32, 0.84);
}

.guide-editor .rich-editor {
  overflow: visible;
  border-color: rgba(91, 139, 184, 0.3);
  border-radius: 14px;
  background: rgba(8, 18, 29, 0.7);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.guide-editor .rich-toolbar {
  position: sticky;
  top: 8px;
  z-index: 8;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(91, 139, 184, 0.3);
  border-radius: 12px 12px 0 0;
  background: rgba(10, 24, 38, 0.96);
  box-shadow: 0 14px 35px rgba(0, 7, 18, 0.34);
  backdrop-filter: blur(14px);
}

.guide-editor .rich-canvas {
  min-height: 420px;
  padding: clamp(22px, 3vw, 38px);
  border-radius: 0 0 12px 12px;
  background: rgba(7, 17, 28, 0.52);
}

@media (min-width: 1180px) {
  .guide-editor .rich-editor:not(.rich-editor-compact) {
    display: grid;
    grid-template-columns: 204px minmax(0, 1fr);
    grid-auto-flow: row;
    align-items: start;
    gap: 10px 12px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .guide-editor .rich-editor:not(.rich-editor-compact) > .rich-toolbar {
    position: sticky;
    top: 86px;
    z-index: 12;
    grid-column: 1;
    grid-row: 1 / span 4;
    width: 204px;
    min-height: 0;
    max-height: calc(100dvh - 104px);
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: center;
    gap: 5px;
    overflow-x: visible;
    overflow-y: auto;
    border: 1px solid rgba(91, 153, 213, 0.25);
    border-radius: 14px;
    background:
      linear-gradient(rgba(255, 255, 255, 0.018), transparent 38%),
      rgba(9, 23, 39, 0.98);
    box-shadow:
      0 14px 34px rgba(2, 9, 20, 0.34),
      inset 0 1px rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(12px);
    scrollbar-color: rgba(86, 161, 218, 0.68) rgba(7, 17, 29, 0.58);
    scrollbar-width: thin;
    scrollbar-gutter: stable;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar::-webkit-scrollbar {
    width: 8px;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar::-webkit-scrollbar-track {
    border-radius: 999px;
    background: rgba(7, 17, 29, 0.58);
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar::-webkit-scrollbar-thumb {
    border: 2px solid rgba(7, 17, 29, 0.58);
    border-radius: 999px;
    background: rgba(86, 161, 218, 0.68);
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar
    > select {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar
    > :is(button, .toolbar-swatch-picker, .toolbar-effect) {
    width: 100%;
    min-width: 0;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar
    > button {
    grid-column: span 1;
    min-height: 40px;
    padding-inline: 6px;
    justify-content: center;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar
    > .toolbar-swatch-picker {
    grid-column: span 2;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar
    > button:has(> span),
  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar
    > .toolbar-effect {
    grid-column: 1 / -1;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar
    > button:nth-of-type(15),
  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar
    > button:nth-of-type(16) {
    grid-column: span 2;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar
    > button:has(> span) {
    justify-content: flex-start;
    padding-inline: 11px;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar
    > button:has(> span)
    span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar
    > .toolbar-swatch-picker
    > summary,
  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar
    > .toolbar-effect
    > button {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar
    > .toolbar-swatch-picker
    > summary {
    min-height: 40px;
    padding: 7px 8px;
    gap: 5px;
    border-color: rgba(89, 142, 190, 0.22);
    background: rgba(22, 43, 64, 0.66);
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar
    .effect-menu {
    right: 0;
    left: 0;
    width: auto;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .rich-toolbar
    > .toolbar-divider {
    grid-column: 1 / -1;
    width: 100%;
    height: 1px;
    margin: 3px 0;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > :is(.rich-canvas, .rich-source, .editor-image-controls, .editor-upload-status) {
    grid-column: 2;
    min-width: 0;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > :is(.rich-canvas, .rich-source) {
    grid-row: 1;
    border-radius: 12px;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .editor-image-controls {
    grid-row: 1;
    align-self: start;
    z-index: 3;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact):has(> .editor-image-controls)
    > :is(.rich-canvas, .rich-source) {
    grid-row: 2;
  }

  .guide-editor
    .rich-editor:not(.rich-editor-compact)
    > .editor-upload-status {
    grid-row: 3;
  }
}

.guide-save {
  position: sticky;
  bottom: 10px;
  z-index: 7;
  margin: 18px -4px -4px;
  padding: 10px;
  border: 1px solid rgba(91, 139, 184, 0.22);
  border-radius: 12px;
  background: rgba(9, 22, 35, 0.94);
  box-shadow: 0 16px 40px rgba(0, 5, 14, 0.38);
  backdrop-filter: blur(12px);
}

.toolbar-swatch-picker {
  position: relative;
}

.toolbar-swatch-picker > summary {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid rgba(82, 121, 158, 0.44);
  border-radius: 8px;
  background: #101d2c;
  color: #a9bdd1;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.toolbar-swatch-picker > summary::-webkit-details-marker {
  display: none;
}

.toolbar-swatch-picker > summary svg {
  width: 15px;
  height: 15px;
}

.toolbar-swatch-picker[open] > summary {
  border-color: #5ba9ed;
  background: #17304a;
  color: #eef7ff;
}

.toolbar-swatch-menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  z-index: 30;
  width: 174px;
  display: grid;
  grid-template-columns: repeat(5, 28px);
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(92, 145, 194, 0.42);
  border-radius: 11px;
  background: #0b1928;
  box-shadow: 0 18px 48px rgba(0, 4, 12, 0.65);
}

.toolbar-swatch-menu button {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 3px !important;
  border-radius: 7px !important;
  background: #142538 !important;
}

.toolbar-swatch-menu button:hover {
  border-color: #6bc5f5 !important;
  transform: translateY(-1px);
}

.toolbar-swatch-menu button i {
  width: 100%;
  height: 100%;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
}

.toolbar-swatch-menu .swatch-clear {
  position: relative;
  background:
    linear-gradient(45deg, transparent 43%, #ff7486 44% 56%, transparent 57%),
    repeating-conic-gradient(#edf4fb 0 25%, #8c9bad 0 50%) 50% / 8px 8px;
}

.rich-canvas {
  caret-color: #f4f8ff;
}

.rich-canvas [data-effect] {
  caret-color: #ffffff;
}

.effect-menu button.active {
  border-color: #6abcf2 !important;
  background: #1d3a56 !important;
  box-shadow: inset 3px 0 #62c7ff;
}

.effect-menu .effect-clear {
  color: #aebfd0;
}

.guide-rich-content [data-effect="red-gradient"],
.guide-rich-content [data-effect="curator"] {
  display: inline-block;
  background: linear-gradient(90deg, #ff8a72, #e83e4f, #ff5d87, #ff9a62);
  background-size: 180% 100%;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: none;
  animation: role-text-flow 3.2s linear infinite;
}

.guide-rich-content [data-effect="gradient-blue"],
.guide-rich-content [data-effect="gradient-violet"],
.guide-rich-content [data-effect="gradient-emerald"] {
  display: inline-block;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

.guide-rich-content [data-effect="gradient-blue"] {
  background-image: linear-gradient(90deg, #59c7ff, #6477ff, #9d6cff);
}

.guide-rich-content [data-effect="gradient-violet"] {
  background-image: linear-gradient(90deg, #d07bff, #8059f3, #ff78cb);
}

.guide-rich-content [data-effect="gradient-emerald"] {
  background-image: linear-gradient(90deg, #64e7b2, #31b889, #b2f56d);
}

.guide-rich-content [data-effect="neon"] {
  color: #83d7ff;
  text-shadow:
    0 0 5px #3b9ae8,
    0 0 14px #2879df,
    0 0 24px #624ee7;
}

/* Keep the image alignment selected in the guide editor when the saved
   content is rendered in the internal reader or through a public link. */
.guide-rich-content img[data-image-align] {
  display: block;
}

.guide-rich-content img[data-image-align="left"] {
  margin-left: 0;
  margin-right: auto;
}

.guide-rich-content img[data-image-align="center"] {
  margin-left: auto;
  margin-right: auto;
}

.guide-rich-content img[data-image-align="right"] {
  margin-left: auto;
  margin-right: 0;
}

.guide-rich-content {
  font-size: var(--ui-text-md, 15px);
  line-height: 1.62;
}

.guide-rich-content p,
.guide-rich-content li {
  font-size: inherit;
  line-height: inherit;
}

.guide-rich-content p {
  margin: 0 0 0.82em;
}

.guide-rich-content h1 {
  margin: 1em 0 0.5em;
  font-size: 1.8em;
  line-height: 1.2;
}

.guide-rich-content h2 {
  margin: 1em 0 0.5em;
  font-size: 1.5em;
  line-height: 1.24;
}

.guide-rich-content h3 {
  margin: 0.9em 0 0.45em;
  font-size: 1.25em;
  line-height: 1.28;
}

.guide-rich-content :is(b, strong) {
  font-weight: 800 !important;
}

.guide-rich-content [data-effect] {
  font-weight: 800;
}

.guide-rich-content > :first-child {
  margin-top: 0;
}

.guide-rich-content > :last-child {
  margin-bottom: 0;
}

.guide-rich-content details.content-spoiler {
  margin: 22px 0;
  overflow: hidden;
  border: 1px solid rgba(92, 151, 199, 0.34);
  border-radius: 13px;
  background: rgba(12, 28, 43, 0.74);
  box-shadow: inset 0 0 0 1px rgba(65, 176, 235, 0.035);
}

.guide-rich-content details.content-spoiler > summary {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  list-style: none;
  background: linear-gradient(
    100deg,
    rgba(50, 89, 127, 0.72),
    rgba(42, 56, 81, 0.7)
  );
  color: #edf5ff;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.guide-rich-content details.content-spoiler > summary::-webkit-details-marker {
  display: none;
}

.guide-rich-content .content-spoiler-body {
  padding: 18px 20px;
  border-top: 1px solid rgba(92, 151, 199, 0.2);
  background: rgba(6, 17, 28, 0.54);
}

.guide-rich-content .content-spoiler-body > :last-child {
  margin-bottom: 0;
}

.guide-rich-content h2,
.guide-rich-content h3 {
  scroll-margin-top: 24px;
}

.content-heading-anchor {
  display: none !important;
}

/* The editor has only two spacing actions: Enter creates a paragraph and
   Shift+Enter creates a line break. Legacy custom indentation is neutralized. */
.rich-canvas [data-indent],
.lesson-rich-content [data-indent],
.guide-rich-content [data-indent] {
  margin-left: 0 !important;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content) {
  color: #eef4ff;
  font-size: var(--ui-text-md, 15px);
  line-height: 1.62;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content) p {
  margin: 0 0 0.82em;
  font-size: inherit;
  line-height: inherit;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content) :is(ul, ol) {
  margin: 0.45em 0 1em;
  padding-left: 1.55em;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content) li {
  margin: 0.24em 0;
  font-size: inherit;
  line-height: inherit;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content) h1 {
  color: #f1f6fc;
  margin: 1em 0 0.5em;
  font-size: 1.8em;
  line-height: 1.2;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content) h2 {
  color: #f1f6fc;
  margin: 1em 0 0.5em;
  font-size: 1.5em;
  line-height: 1.24;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content) h3 {
  color: #f1f6fc;
  margin: 0.9em 0 0.45em;
  font-size: 1.25em;
  line-height: 1.28;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content) > :first-child {
  margin-top: 0;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content) > :last-child {
  margin-bottom: 0;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  blockquote.content-quote-block {
  margin: 1em 0;
  padding: 13px 16px;
  border: 1px dashed rgba(93, 160, 232, 0.28);
  border-left: 3px solid #58b4ff;
  border-radius: 0 12px 12px 0;
  background: rgba(18, 43, 66, 0.58);
  color: #b8cce0;
  box-shadow: inset 3px 0 #58b4ff, 0 12px 26px rgba(3, 12, 26, 0.16);
}

.rich-canvas blockquote.content-quote-block::before {
  content: "Блок цитаты";
  display: block;
  margin-bottom: 10px;
  color: #72baff;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  blockquote.content-quote-block
  > :last-child {
  margin-bottom: 0;
}

:is(.lesson-rich-content, .guide-rich-content)
  details.content-spoiler::before,
:is(.lesson-rich-content, .guide-rich-content) .content-mini-log::before {
  display: block;
  color: #72baff;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

:is(.lesson-rich-content, .guide-rich-content)
  details.content-spoiler::before {
  content: "Блок спойлера";
  margin-bottom: 10px;
  padding: 12px 16px 0;
}

:is(.lesson-rich-content, .guide-rich-content) .content-mini-log::before {
  content: "Блок логов";
  margin-bottom: 10px;
}

.guide-rich-content .content-mini-log,
.guide-rich-content [data-mini-log] {
  --mini-log-accent: #6faeff;
  width: 100%;
  margin: 14px 0;
  overflow-x: auto;
  border: 1px solid rgba(112, 143, 181, 0.25);
  border-radius: 14px;
  background: #0d1727;
  color: #b9cbe0;
  box-shadow: inset 3px 0 0 var(--mini-log-accent);
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content) pre {
  margin: 1em 0;
  overflow-x: auto;
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 9px;
  background: #030a13;
  color: #8fc9ff;
  font-family: "Cascadia Code", Consolas, monospace;
  line-height: 1.55;
  white-space: pre-wrap;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content) a {
  color: #66b1fa;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  details.content-spoiler {
  margin: 20px 0;
  overflow: hidden;
  border: 1px solid rgba(131, 153, 188, 0.24);
  border-radius: 12px;
  outline: 1px dashed rgba(93, 160, 232, 0.26);
  background: rgba(74, 84, 108, 0.18);
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  details.content-spoiler
  > summary {
  min-height: 48px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  background: rgba(103, 111, 135, 0.34);
  color: #edf3ff;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  .content-spoiler-body {
  padding: 18px 20px;
  border-top: 1px solid rgba(131, 153, 188, 0.18);
  background: rgba(9, 18, 32, 0.38);
}

.rich-canvas figure.content-image,
.lesson-rich-content figure.content-image,
.guide-rich-content figure.content-image {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 1.15em auto;
  padding: 0;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  .content-image-grid {
  --image-grid-gap: clamp(14px, 2vw, 24px);
  width: min(100%, 980px);
  margin: 1.35em auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: var(--image-grid-gap);
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  .content-image-grid:is(
    [data-image-grid="2"],
    [data-image-grid="2x1"],
    [data-image-grid="2x2"]
  )
  > :is(.content-image-grid-item, figure.content-image) {
  flex: 0 1 calc((100% - var(--image-grid-gap)) / 2);
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  .content-image-grid:is(
    [data-image-grid="3"],
    [data-image-grid="3x1"],
    [data-image-grid="3x3"]
  )
  > :is(.content-image-grid-item, figure.content-image) {
  flex: 0 1 calc((100% - 2 * var(--image-grid-gap)) / 3);
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  .content-image-grid-item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  .content-image-grid
  > figure.content-image {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  .content-image-grid
  > figure.content-image
  > img {
  width: 100% !important;
  height: auto;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  .content-image-grid-item
  > figure.content-image {
  width: 100% !important;
  max-width: 430px !important;
  margin: 0 auto 0.55em !important;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  .content-image-grid-item
  > figure.content-image
  > img {
  width: 100% !important;
  height: auto;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  .content-image-grid-item
  > :is(p, div) {
  width: 100%;
  margin: 0.08em 0;
  text-align: center !important;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  .content-image-grid-item
  > :last-child {
  margin-bottom: 0;
}

.rich-canvas .content-image-grid {
  position: relative;
  padding: 30px 14px 14px;
  border: 1px dashed rgba(88, 180, 255, 0.38);
  border-radius: 14px;
  background: rgba(14, 35, 55, 0.42);
}

.rich-canvas .content-image-grid::before {
  content: "Карточки · " attr(data-image-grid);
  position: absolute;
  top: 7px;
  left: 12px;
  color: #72baff;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rich-canvas .content-image-grid-item {
  padding: 10px;
  border: 1px dashed rgba(96, 164, 221, 0.2);
  border-radius: 11px;
  background: rgba(8, 23, 37, 0.32);
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  figure.content-image[data-image-align="left"] {
  margin-left: 0;
  margin-right: auto;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  figure.content-image[data-image-align="center"] {
  margin-left: auto;
  margin-right: auto;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  figure.content-image[data-image-align="right"] {
  margin-left: auto;
  margin-right: 0;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  figure.content-image
  > img {
  display: block;
  max-width: 100%;
  max-height: 75vh;
  margin: 0 !important;
  border: 1px solid #294766;
  border-radius: 14px;
  background: #07111e;
  box-shadow: 0 14px 34px rgba(2, 8, 21, 0.4);
  object-fit: contain;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  figure.content-image[style]
  > img {
  width: 100% !important;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  figure.content-image
  > figcaption {
  max-width: 100%;
  margin-top: 8px;
  color: #aebdd0;
  font-size: 0.88em;
  font-style: italic;
  line-height: 1.4;
  text-align: center;
  overflow-wrap: anywhere;
}

:is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
  figure.content-image
  > figcaption:empty {
  display: none;
}

.editor-image-caption-field {
  min-width: min(330px, 100%);
  flex: 1 1 300px;
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr);
  align-items: center;
  gap: 9px;
}

.editor-image-grid-controls {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 5px 4px 10px;
  border: 1px solid rgba(70, 118, 158, 0.46);
  border-radius: 9px;
  background: rgba(8, 23, 37, 0.76);
}

.editor-image-grid-controls > span {
  margin-right: 2px;
  color: #a9bdd2;
  font-size: 12px;
  font-weight: 750;
}

.editor-image-grid-controls > button {
  min-width: 34px;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(48, 82, 112, 0.34);
  color: #a8bfd5;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.editor-image-grid-controls > button:hover {
  border-color: rgba(89, 174, 239, 0.45);
  color: #eaf6ff;
}

.editor-image-grid-controls > button.active {
  border-color: rgba(89, 181, 244, 0.7);
  background: linear-gradient(145deg, #1d76b5, #365ab1);
  color: #fff;
  box-shadow: 0 5px 14px rgba(26, 111, 182, 0.25);
}

.editor-image-caption-field > span {
  color: #a9bdd2;
  font-size: 12px;
  font-weight: 750;
}

.editor-image-caption-field > input {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #294866;
  border-radius: 8px;
  outline: 0;
  background: #081725;
  color: #e9f3ff;
}

.editor-image-caption-field > input:focus {
  border-color: #58adf0;
  box-shadow: 0 0 0 3px rgba(52, 136, 221, 0.16);
}

.editor-image-delete {
  min-height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(224, 87, 105, 0.42);
  border-radius: 8px;
  background: rgba(91, 28, 40, 0.42);
  color: #ff9baa;
}

.editor-image-delete:hover {
  border-color: rgba(255, 122, 140, 0.7);
  background: rgba(120, 35, 50, 0.58);
}

.editor-image-delete svg {
  width: 15px;
  height: 15px;
}

@media (max-width: 850px) {
  .guide-editor {
    padding: 14px;
    border-radius: 14px;
  }

  .guide-editor .guide-editor-meta {
    grid-template-columns: 1fr;
  }

  .guide-editor .rich-toolbar {
    position: static;
  }

  .guide-editor .rich-canvas {
    min-height: 320px;
    padding: 18px;
  }

  .toolbar-swatch-menu {
    right: auto;
    left: 0;
  }

  .content-heading-anchor {
    opacity: 0;
  }

  .editor-image-caption-field {
    flex-basis: 100%;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  :is(.rich-canvas, .lesson-rich-content, .guide-rich-content)
    .content-image-grid
    > :is(.content-image-grid-item, figure.content-image) {
    flex-basis: 100% !important;
    max-width: min(100%, 560px) !important;
  }

  .editor-image-grid-controls {
    width: 100%;
    justify-content: center;
  }

  .guide-share-list article {
    align-items: stretch;
    flex-direction: column;
  }

  .guide-share-list article > span {
    min-width: 0;
  }

  .guide-share-list article > span b {
    overflow-wrap: anywhere;
  }

  .guide-share-list article > div {
    width: 100%;
  }

  .guide-share-list article > div button {
    flex: 1;
    justify-content: center;
  }
}
