.spm-tools {
  margin: 10px 0 16px;
  display: grid;
  gap: 6px
}

.spm-tools [data-spm-add] {
  border: 1px dashed #91ad9b;
  background: #f6faf7;
  color: #215a48;
  min-height: 40px;
  width: 100%
}

.spm-tools .spm-edit {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f7f9f6;
  text-align: left;
  padding: 7px 10px
}

.spm-edit img {
  width: 48px;
  height: 40px;
  object-fit: cover;
  border-radius: 5px
}

.spm-edit span {
  flex: 1;
  overflow-wrap: anywhere
}

.spm-edit small {
  color: #53675e
}

dialog.spm-settings,
dialog.spm-zoom {
  margin: auto;
  border: 0;
  border-radius: 14px;
  max-height: 90dvh;
  padding: 20px;
  color: #233f33;
  background: white;
  overflow: auto
}

dialog.spm-settings {
  width: min(440px,94vw)
}

.spm-settings h2 {
  margin: 0 0 12px
}

.spm-settings label {
  display: grid;
  gap: 4px;
  margin: 10px 0;
  font-size: 14px;
  font-weight: 600
}

.spm-settings input,
.spm-settings select {
  width: 100%;
  padding: 8px;
  border: 1px solid #bbcec1;
  border-radius: 6px;
  font: inherit
}

.spm-settings .spm-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px
}

.spm-actions [data-remove] {
  margin-right: auto
}

.spm-note,
.spm-error {
  font-size: 13px
}

.spm-error {
  color: #8e3326
}

.spm-settings::backdrop,
.spm-zoom::backdrop {
  background: #10251dba
}

.spm-content {
  white-space: normal
}

.spm-content p {
  white-space: pre-wrap;
  overflow-wrap: anywhere
}

.spm-content figure {
  margin: 12px 0
}

.spm-content figcaption {
  font-size: 14px;
  line-height: 1.5;
  margin: 5px 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap
}

.spm-content button.spm-image {
  display: block;
  position: relative;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 8px;
  overflow: hidden;
  color: white
}

.spm-image img {
  display: block;
  width: 100%;
  max-height: 250px;
  object-fit: contain;
  background: #12241d
}

.spm-image span {
  position: absolute;
  right: 6px;
  bottom: 6px;
  border-radius: 12px;
  padding: 3px 8px;
  color: white;
  background: #172b22e8;
  font-size: 12px
}

.spm-zoom {
  width: min(850px,95vw)
}

.spm-zoom>button {
  display: block;
  margin: 0 0 10px auto;
  min-height: 40px;
  padding: 6px 15px
}

.spm-zoom img {
  display: block;
  margin: auto;
  max-width: 100%;
  max-height: 68dvh;
  object-fit: contain
}

.spm-zoom p {
  margin: 7px 0 0;
  overflow-wrap: anywhere
}

.scene-design > .spm-stage {
  position: absolute;
  inset: 76px 16px 70px;
  z-index: 3;
  display: grid;
  grid-template-rows: minmax(0,1fr);
  align-items: center;
  pointer-events: none;
}

#phone .spm-stage > .scene-copy {
  position: static;
  box-sizing: border-box;
  max-height: 100%;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  pointer-events: auto;
  padding: 14px;
  text-align: center;
}

.story-runtime .story-screen.spm-scene {
  justify-content: center
}

.spm-scene > .story-stage:empty {
  display: none
}

.story-runtime .spm-scene > .story-dialogue {
  display: flex;
  flex-direction: column;
  max-height: calc(100% - 16px);
  min-height: 0;
  margin-block: 0;
  box-sizing: border-box;
}

.spm-scene .story-meta {
  flex: none
}

.story-runtime .spm-scene .story-copy {
  max-height: none;
  min-height: 0;
  text-align: center;
}
