/* CosmoMango custom story text engine · schemaVersion 5 */
.creator-result-visual:has(.material-editor-canvas) {
  position: relative;
}

.creator-result-visual.is-editor-v5-enabled,
.creator-result-visual.is-editor-v5-enabled .material-editor-canvas,
.creator-result-visual.is-editor-v5-enabled .editor-v5-inline-editor {
  touch-action: none;
  overscroll-behavior: contain;
  -webkit-user-select: none;
  user-select: none;
}

.editor-v5-inline-editor {
  position: absolute;
  z-index: 12;
  display: none;
  overflow: visible;
  margin: 0;
  border: 0;
  outline: 0;
  box-sizing: border-box;
  background: transparent;
  caret-color: #7455ff;
  white-space: pre-wrap;
  overflow-wrap: normal;
  -webkit-user-select: text;
  user-select: text;
  -webkit-tap-highlight-color: transparent;
}

.editor-v5-inline-editor.is-visible {
  display: block;
}

.editor-v5-inline-editor::selection {
  background: rgb(116 85 255 / 28%);
}

.editor-v5-root {
  min-height: 0;
}

.editor-v5-message {
  margin: 0;
  padding: 8px 12px;
  color: #d8d5e8;
  font: 700 12px/1.25 Inter, system-ui, sans-serif;
  text-align: center;
}

.editor-v5-message.is-conflict {
  color: #ffbf8d;
}

.editor-v5-dock {
  --editor-v5-keyboard-offset: 0px;
  position: fixed;
  z-index: 10040;
  right: max(8px, env(safe-area-inset-right));
  bottom: calc(var(--editor-v5-keyboard-offset) + max(8px, env(safe-area-inset-bottom)));
  left: max(8px, env(safe-area-inset-left));
  width: min(680px, calc(100vw - 16px));
  max-height: min(168px, 28vh);
  margin-inline: auto;
  padding: 7px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 18px;
  background: rgb(28 27 31 / 94%);
  box-shadow: 0 12px 40px rgb(0 0 0 / 34%);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  box-sizing: border-box;
}

.editor-v5-dock[hidden],
.editor-v5-tray[hidden] {
  display: none !important;
}

.editor-v5-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}

.editor-v5-tabs button,
.editor-v5-option {
  min-width: 0;
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-radius: 11px;
  color: #f8f7fb;
  background: rgb(255 255 255 / 7%);
  font: 750 13px/1 Inter, system-ui, sans-serif;
  white-space: nowrap;
}

.editor-v5-tabs button[aria-pressed="true"],
.editor-v5-option.is-selected {
  color: #17121f;
  background: #ffffff;
}

.editor-v5-tray {
  display: flex;
  gap: 6px;
  min-height: 38px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1px 1px 3px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.editor-v5-tray::-webkit-scrollbar {
  display: none;
}

.editor-v5-option {
  flex: 0 0 auto;
  min-width: 76px;
}

.editor-v5-swatch,
.editor-v5-color-custom {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--editor-v5-swatch, transparent);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 28%);
}

.editor-v5-swatch.is-selected {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px #7455ff;
}

.editor-v5-color-custom {
  overflow: hidden;
  border-radius: 10px;
}

.editor-v5-color-custom::-webkit-color-swatch-wrapper {
  padding: 0;
}

.editor-v5-color-custom::-webkit-color-swatch {
  border: 0;
}

.creator-result-card:not(.is-editor-fullscreen) .editor-v5-message,
.creator-result-card:not(.is-editor-fullscreen) .editor-v5-dock {
  display: none !important;
}

@media (max-width: 540px) {
  .editor-v5-dock {
    max-height: 146px;
    border-radius: 15px;
  }

  .editor-v5-tabs button,
  .editor-v5-option {
    min-height: 32px;
    padding: 5px 8px;
    font-size: 12px;
  }
}
