.tr-core-editor-surface {
  position: relative;
  display: grid;
  gap: 14px;
}

.tr-core-editor-frame {
  position: relative;
  min-height: 320px;
  border: 1px solid #d7dee9;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,251,255,0.98)),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 35px,
      rgba(203, 213, 225, 0.45) 35px,
      rgba(203, 213, 225, 0.45) 36px
    );
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.tr-core-editor-frame.is-document {
  border-radius: 22px;
  background:
    linear-gradient(180deg, #ffffff, #fdfefe),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 35px,
      rgba(203, 213, 225, 0.4) 35px,
      rgba(203, 213, 225, 0.4) 36px
    );
}

.tr-core-editor-canvas {
  min-height: 320px;
  padding: 38px 42px;
  outline: none;
  line-height: 1.85;
  font-size: 16px;
  color: #132238;
}

.tr-core-editor-canvas > *:first-child {
  margin-top: 0;
}

.tr-core-editor-canvas h1,
.tr-core-editor-canvas h2,
.tr-core-editor-canvas h3 {
  margin: 0 0 12px;
  line-height: 1.22;
  color: #14213a;
}

.tr-core-editor-canvas p,
.tr-core-editor-canvas ul,
.tr-core-editor-canvas ol,
.tr-core-editor-canvas blockquote {
  margin: 0 0 12px;
}

.tr-core-editor-canvas blockquote {
  padding: 12px 16px;
  border-left: 4px solid #5b63f6;
  background: rgba(91, 99, 246, 0.06);
  border-radius: 0 14px 14px 0;
}

.tr-core-editor-canvas hr {
  border: 0;
  border-top: 1px solid #cbd5e1;
  margin: 18px 0;
}

.tr-core-editor-canvas a.tr-inline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: 999px;
  background: #1d4ed8;
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
}

.tr-core-editor-floating-toolbar {
  position: fixed;
  z-index: 1200;
  display: none;
  align-items: center;
  flex-wrap: wrap;
  max-width: calc(100vw - 16px);
  gap: 4px;
  padding: 7px;
  border: 1px solid rgba(203, 213, 225, 0.82);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(10px);
}

.tr-core-editor-floating-toolbar.is-open {
  display: inline-flex;
}

.tr-core-editor-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1;
  display: none;
  grid-template-columns: repeat(2, minmax(132px, 1fr));
  gap: 4px;
  min-width: 284px;
  padding: 7px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.99);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
}

.tr-core-editor-floating-toolbar.is-more-open .tr-core-editor-more-menu {
  display: grid;
}

.tr-core-editor-more-menu button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  padding-inline: 10px;
  text-align: left;
}

.tr-core-editor-more-menu button svg {
  width: 15px;
  height: 15px;
  margin: 0;
}

.tr-core-editor-floating-toolbar button,
.tr-core-editor-floating-toolbar select {
  border: 1px solid transparent;
  background: transparent;
  color: #132238;
  border-radius: 11px;
  min-width: 36px;
  min-height: 36px;
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.tr-core-editor-floating-toolbar button svg {
  display: block;
  width: 16px;
  height: 16px;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
}

.tr-core-editor-floating-toolbar select {
  min-width: 92px;
  appearance: none;
  background:
    linear-gradient(180deg, rgba(248,250,252,0.95), rgba(255,255,255,0.95));
  border-color: #e2e8f0;
}

.tr-core-editor-floating-toolbar button:hover,
.tr-core-editor-floating-toolbar select:hover,
.tr-core-editor-floating-toolbar button.is-active {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #3146d6;
  transform: translateY(-1px);
}

.tr-core-editor-floating-toolbar .tr-toolbar-divider {
  width: 1px;
  height: 26px;
  background: #d7dee9;
  margin: 0 2px;
}

/* Inline media is real document content.  The editor only adds the selected
   state and resize handles; public pages keep the same alignment and size. */
.tr-inline-media {
  position: relative;
  display: table;
  box-sizing: border-box;
  max-width: 100%;
  margin: 22px 0;
  overflow: visible;
}

.tr-inline-media[align="center"] { margin-inline: auto; }
.tr-inline-media[align="right"] { float: right; margin: 6px 0 16px 24px; }
.tr-inline-media[align="left"] { float: left; margin: 6px 24px 16px 0; }

.tr-inline-media img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  cursor: pointer;
}

.tr-inline-media.is-selected img {
  outline: 2px solid #12b8dd;
  outline-offset: 4px;
}

.tr-inline-media-resize {
  position: absolute;
  z-index: 30;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  padding: 0;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #087e9b;
  box-shadow: 0 7px 18px rgba(15, 23, 42, .34);
  cursor: nwse-resize;
  touch-action: none;
}

.tr-inline-media-resize::after {
  content: "";
  display: grid;
  width: 6px;
  height: 6px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
}

.tr-inline-media-resize--nw { top: 4px; left: 4px; }
.tr-inline-media-resize--ne { top: 4px; right: 4px; }
.tr-inline-media-resize--sw { bottom: 4px; left: 4px; }
.tr-inline-media-resize--se { right: 4px; bottom: 4px; }
.tr-inline-media-resize--ne,
.tr-inline-media-resize--sw { cursor: nesw-resize; }

@media (max-width: 720px) {
  /* A saved desktop width must never make the document wider than a phone. */
  .tr-inline-media,
  .tr-inline-media[align="left"],
  .tr-inline-media[align="right"] {
    float: none;
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 18px 0;
  }

  .tr-inline-media img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }
}

.tr-core-editor-image-tools {
  position: fixed;
  z-index: 1210;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(203, 213, 225, .9);
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 15px 34px rgba(15, 23, 42, .2);
}

.tr-core-editor-image-tools.is-open { display: inline-flex; }

.tr-core-editor-image-tools button {
  min-width: 32px;
  min-height: 32px;
  padding: 5px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #17344e;
  cursor: pointer;
  font-weight: 800;
}

.tr-core-editor-image-tools button:hover { background: #e5f7fb; color: #087e9b; }
.tr-image-tools-divider { width: 1px; height: 22px; background: #dbe3ec; }

.tr-core-editor-slash-menu {
  position: fixed;
  z-index: 1190;
  display: none;
  width: 260px;
  max-height: 320px;
  overflow: auto;
  border: 1px solid rgba(203, 213, 225, 0.86);
  border-radius: 18px;
  background: rgba(255,255,255,0.98);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(10px);
  padding: 8px;
}

.tr-core-editor-slash-menu.is-open {
  display: block;
}

.tr-core-editor-slash-item {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

.tr-core-editor-slash-item:hover,
.tr-core-editor-slash-item.is-active {
  background: #f1f5ff;
}

.tr-core-editor-slash-item strong {
  font-size: 14px;
  color: #132238;
}

.tr-core-editor-slash-item span {
  font-size: 12px;
  color: #64748b;
}

.tr-core-editor-fieldbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.tr-core-editor-hint {
  color: #64748b;
  font-size: 12px;
}
