.wm-editor {
  box-sizing: border-box;
  max-width: 1240px;
  margin-inline: auto;
  padding: clamp(15px, 2.5vw, 32px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
}
.wm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(270px, 1fr);
  align-items: start;
  gap: clamp(16px, 2.6vw, 32px);
}
.wm-workspace,
.wm-controls { min-width: 0; }
.wm-picker {
  display: grid;
  place-content: center;
  gap: 9px;
  min-height: 240px;
  width: 100%;
  border: 1px dashed var(--primary);
  border-radius: 12px;
  color: var(--primary-dark, var(--primary));
  background: var(--primary-soft);
  cursor: pointer;
}
.wm-picker strong { font-size: 18px; }
.wm-picker small, .wm-control small { color: var(--ink-soft); font-size: 13px; font-weight: 400; }
.wm-picker-copy { display: grid; gap: 9px; }
.wm-preview {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 12px;
}
.wm-preview-bar,
.wm-preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
}
.wm-source-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wm-stage {
  width: 100%;
  margin: 5px auto 10px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 8px;
  background: #212230;
}
.wm-stage > :is(img, video) {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.wm-overlay { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.wm-mark-box {
  position:absolute;
  border: 1px solid white;
  border-radius: 3px;
  box-shadow: 0 0 0 1px #25184fb5;
  touch-action: none;
  cursor: move;
}
.wm-resize {
  position: absolute;
  display: grid;
  place-items: center;
  right: 0;
  bottom: 0;
  width: 28px;
  height: 28px;
  transform: translate(48%,48%);
  border: 1px solid #fff;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  touch-action: none;
  cursor: nwse-resize;
}
.wm-preview-actions { flex-wrap: wrap; }
.wm-player {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  color: var(--ink-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}
.wm-player input { width: 100%; min-width: 0; margin: 0; }
.wm-hint { color: var(--ink-soft); margin: 8px 0 2px; font-size: 13px; }
.wm-controls {
  width: 100%;
  display: grid;
  align-content: start;
  gap: 14px;
  border: 0;
  margin: 0;
  padding: 0;
}
.wm-sr {
  position:absolute;
  width:1px;
  height:1px;
  overflow:hidden;
  clip-path: inset(50%);
  white-space:nowrap;
}
.wm-segment {
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--primary-soft);
}
.wm-segment > button {
  flex: 1 1 auto;
  min-height: 34px;
  border: 0;
  padding: 6px 10px;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.wm-segment > button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--primary-dark, var(--primary));
}
.wm-control {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: var(--ink);
  font-size: 14px;
}
.wm-control > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
  font-weight: 650;
}
.wm-control output {
  font-weight: 500;
  color: var(--ink-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.wm-control :is(input[type="text"],select),
.wm-file-button {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.wm-file-button {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  border-style: dashed;
  color: var(--primary-dark, var(--primary));
  cursor: pointer;
}
.wm-editor :is(input[type="range"],input[type="checkbox"],progress) { accent-color: var(--primary); }
.wm-control input[type="range"] { width: 100%; min-width: 0; min-height: 20px; margin-inline: 0; }
.wm-colors { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wm-colors :is(button,input) {
  box-sizing: border-box;
  width: 26px;
  height: 26px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.wm-colors > button { background: var(--wm-swatch); }
.wm-colors button[aria-pressed="true"] { outline: 2px solid var(--primary); outline-offset: 1px; }
.wm-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wm-columns > :only-child { grid-column: 1 / -1; }
.wm-settings-extra {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.wm-check { display: inline-flex; gap: 7px; align-items: center; min-height: 26px; font-size: 14px; }
.wm-link {
  width: fit-content;
  min-height: 32px;
  border: 0;
  padding: 5px 0;
  background: transparent;
  color: var(--primary-dark, var(--primary));
  text-decoration: none;
  text-align: left;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
.wm-link:hover { text-decoration: underline; }
.wm-primary {
  min-height: 44px;
  border: 0;
  padding: 9px 14px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.wm-editor :is(button,input,select,a,div[tabindex]):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
.wm-editor :is(button,input,select):disabled { cursor: default; opacity: .6; }
.wm-preview-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
}
.wm-notice {
  box-sizing: border-box;
  width: min(440px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  padding: clamp(16px, 4vw, 24px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  overflow: auto;
}
.wm-notice::backdrop { background: rgb(17 17 35 / 52%); }
.wm-notice-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.wm-notice-heading h2 { margin: 4px 0 0; font-size: 20px; line-height: 1.4; }
.wm-notice-close {
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--ink);
  cursor: pointer;
}
.wm-notice p { margin: 8px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.65; }
.wm-notice-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.wm-notice-progress progress { flex: 1; min-width: 0; height: 10px; }
.wm-notice-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.wm-notice-actions :is(button,a) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 13px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
}
.wm-notice-secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
@media (max-width: 880px) {
  .wm-layout { grid-template-columns: minmax(0, 1fr); }
  .wm-picker { min-height: 152px; }
}

.wm-editor-h5 {
  --wm-preview-height: clamp(154px, 32vh, 268px);
  --wm-dock-space: calc(74px + env(safe-area-inset-bottom, 0px));
  max-width: 560px;
  padding: 0;
  border: 0;
  background: transparent;
}
@supports (height: 1svh) {
  .wm-editor-h5 { --wm-preview-height: clamp(154px, 32svh, 268px); }
}
.wm-editor-h5.wm-has-actions { padding-bottom: var(--wm-dock-space); }
.wm-editor-h5 .wm-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.wm-editor-h5 .wm-picker {
  grid-template-columns: 48px minmax(0, 1fr) 30px;
  place-content: stretch;
  align-items: center;
  gap: 12px;
  min-height: 108px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}
.wm-editor-h5 .wm-picker:active { background: var(--surface-soft); }
.wm-editor-h5 .wm-picker-copy { gap: 4px; }
.wm-editor-h5 .wm-picker strong { font-size: 16px; }
.wm-editor-h5 .wm-picker small { line-height: 1.5; }
.wm-h5-picker-icon, .wm-h5-source-icon {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 10px;
  color: var(--primary-dark, var(--primary));
  background: var(--primary-soft);
}
.wm-h5-picker-add { justify-self: center; color: var(--primary-dark, var(--primary)); }
.wm-editor-h5 .wm-preview { padding: 10px; border-radius: 14px; }
.wm-editor-h5 .wm-preview-bar { margin-bottom: 8px; min-height: 44px; }
.wm-h5-source {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.wm-h5-source .wm-source-name { font-weight: 650; color: var(--ink); }
.wm-h5-source small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.wm-editor-h5 .wm-preview-bar > button {
  flex: none;
  min-height: 44px;
  padding-inline: 9px;
  color: var(--primary-dark, var(--primary));
}
.wm-h5-viewfinder {
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 12px 14px;
}
.wm-editor-h5 .wm-stage { margin: 0 auto; overflow: visible; }
.wm-editor-h5 .wm-stage > :is(img,video,canvas) { border-radius: inherit; }
.wm-editor-h5 .wm-mark-box { box-shadow: 0 0 0 1px rgb(17 24 39 / 65%); }
.wm-editor-h5 .wm-resize {
  z-index: 1;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  transform: translate(50%, 50%);
}
.wm-editor-h5 .wm-resize::before {
  content: "";
  position: absolute;
  width: 25px;
  height: 25px;
  border: 1px solid #fff;
  border-radius: 50%;
  background: var(--primary);
}
.wm-editor-h5 .wm-resize svg { position: relative; }
.wm-editor-h5 .wm-player {
  min-height: 44px;
  gap: 6px;
  margin: 5px 0 0;
  font-size: 12px;
}
.wm-editor-h5 .wm-player > button {
  display: grid;
  place-items: center;
  min-height: 44px;
  min-width: 44px;
  border-radius: 8px;
  background: var(--surface-soft);
}
.wm-editor-h5 input[type="range"] {
  min-height: 34px;
  margin-block: 0;
  touch-action: pan-y;
}
.wm-editor-h5 .wm-preview-actions { gap: 5px; margin-top: 6px; }
.wm-editor-h5 .wm-preview-actions .wm-segment {
  flex: 1;
  min-width: 0;
  gap: 2px;
  padding: 2px;
  border-color: transparent;
  background: var(--surface-soft);
}
.wm-editor-h5 .wm-preview-actions .wm-segment > button { padding-inline: 5px; }
.wm-editor-h5 .wm-preview-actions .wm-segment > button[aria-pressed="true"] { color: var(--primary-dark, var(--primary)); }
.wm-editor-h5 .wm-preview-tools:empty { display: none; }
.wm-editor-h5 .wm-remove { display: inline-flex; align-items: center; gap: 3px; min-height: 44px; padding-inline: 6px; }
.wm-editor-h5 .wm-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 7px 0 2px;
  font-size: 12px;
}
.wm-editor-h5 .wm-controls {
  box-sizing: border-box;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.wm-h5-settings-title { margin: 0; font-size: 16px; line-height: 1.4; }
.wm-editor-h5 .wm-type-switch { gap: 4px; padding: 3px; border-color: transparent; background: var(--surface-soft); }
.wm-editor-h5 .wm-segment > button { min-height: 44px; }
.wm-editor-h5 .wm-type-switch > button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.wm-editor-h5 .wm-control :is(input[type="text"],select) {
  min-height: 44px;
  padding-inline: 10px;
  font-size: 16px;
  background: var(--surface-soft);
  caret-color: var(--primary);
}
.wm-editor-h5 .wm-control > span { min-height: 18px; }
.wm-editor-h5 .wm-file-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 10px;
  background: var(--surface-soft);
}
.wm-editor-h5 .wm-file-button > svg { flex: none; }
.wm-editor-h5 .wm-file-button > span { min-width: 0; }
.wm-editor-h5 .wm-file-button small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-soft);
}
.wm-editor-h5 .wm-colors { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; }
.wm-editor-h5 .wm-colors > button { width: 100%; height: 44px; border: 0; background: transparent; }
.wm-editor-h5 .wm-colors > button { display: grid; place-items: center; }
.wm-editor-h5 .wm-colors > button::before {
  content: "";
  width: 25px;
  height: 25px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--wm-swatch);
}
.wm-editor-h5 .wm-colors > button[aria-pressed="true"]:not(:focus-visible) { outline: 0; }
.wm-editor-h5 .wm-colors > button[aria-pressed="true"]::before { outline: 2px solid var(--primary); outline-offset: 2px; }
.wm-h5-custom-color {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 44px;
  color: var(--primary-dark, var(--primary));
  cursor: pointer;
}
.wm-h5-custom-color svg {
  box-sizing: content-box;
  padding: 5px;
  border: 1px dashed var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
}
.wm-h5-custom-color > input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}
.wm-h5-custom-color:focus-within svg { outline: 2px solid var(--primary); outline-offset: 2px; }
.wm-editor-h5 .wm-settings-extra { padding: 0 0 8px; border: 0; }
.wm-h5-extra { min-width: 0; border-top: 1px solid var(--line); }
.wm-h5-extra summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}
.wm-h5-extra summary::-webkit-details-marker { display: none; }
.wm-h5-extra summary small { margin-left: auto; color: var(--ink-soft); font-size: 12px; font-weight: 400; }
.wm-h5-extra[open] summary svg { transform: rotate(180deg); }
.wm-editor-h5 .wm-check, .wm-editor-h5 .wm-settings-extra > button { min-height: 44px; }
.wm-editor-h5 .wm-check input { width: 18px; height: 18px; }
.wm-h5-actions {
  position: fixed;
  z-index: 20;
  inset: auto 0 0;
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-block: 9px calc(9px + env(safe-area-inset-bottom, 0px));
  padding-left: max(12px, env(safe-area-inset-left, 0px), calc((100% - 556px) / 2));
  padding-right: max(12px, env(safe-area-inset-right, 0px), calc((100% - 556px) / 2));
  background: var(--surface);
}
.wm-h5-actions .wm-primary { flex: 1; min-height: 48px; font-size: 16px; }
.wm-h5-save-video {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding-inline: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--primary-dark, var(--primary));
  font-size: 14px;
  font-weight: 650;
}
html[data-h5-keyboard] .wm-h5-actions { display: none; }
html[data-h5-keyboard] .wm-editor-h5.wm-has-actions { padding-bottom: 0; }
.wm-editor-h5 .wm-notice {
  position: fixed;
  inset: auto 0 0;
  width: min(100%, 520px);
  margin: 0 auto;
  border-radius: 16px 16px 0 0;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
}
.wm-editor-h5 .wm-notice-close { flex-basis: 44px; height: 44px; }
.wm-editor-h5 .wm-notice-heading h2 { padding-top: 3px; font-size: 18px; }
.wm-editor-h5 .wm-notice-actions { justify-content: stretch; gap: 6px; }
.wm-editor-h5 .wm-notice-actions > :is(a,button) { flex: 1; min-height: 44px; padding-inline: 8px; }
@media (orientation: landscape) and (min-width: 640px) {
  .wm-editor-h5 { --wm-preview-height: clamp(128px, 41vh, 248px); max-width: 920px; }
  .wm-editor-h5 .wm-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .wm-h5-actions { padding-block: 6px calc(6px + env(safe-area-inset-bottom, 0px)); }
}
