/* DrawingMotion tool styles.
   Only these theme variables are used (each with a fallback):
   --bg --card --text --muted --primary --accent --line --radius */

.dm-tool, .dm-tool *, .dm-tool *::before, .dm-tool *::after { box-sizing: border-box; }

.dm-tool {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  color: var(--text, #f2eee6);
  font-size: 15px;
  line-height: 1.45;
}
@media (max-width: 879.98px) {
  .dm-tool { grid-template-columns: minmax(0, 1fr); }
}
.dm-left { min-width: 0; max-width: 100%; }

/* ---- film-strip frame: the single decorative motif ---- */
.dm-film {
  position: relative;
  padding: 30px 18px;
  background: var(--card, #1c2030);
  border: 1px solid var(--line, #2a3046);
  border-radius: 18px;
}
.dm-film::before,
.dm-film::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  height: 14px;
  background-image: radial-gradient(ellipse 5px 4px at center, var(--bg, #0f1119) 0 94%, transparent 100%);
  background-size: 26px 14px;
  background-repeat: repeat-x;
  background-position: left center;
}
.dm-film::before { top: 8px; }
.dm-film::after { bottom: 8px; }

.dm-stage-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg, #0f1119);
}
.dm-stage-wrap.is-drag { outline: 3px dashed var(--primary, #ffb347); outline-offset: -3px; }
.dm-stage { display: block; width: 100%; height: 100%; border-radius: 8px; }

/* ---- empty state ---- */
.dm-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
}
.dm-empty[hidden] { display: none; }
.dm-empty-card {
  display: grid;
  gap: 12px;
  justify-items: center;
  max-width: 380px;
  padding: 22px 22px 20px;
  background: var(--card, #1c2030);
  border: 1px solid var(--line, #2a3046);
  border-radius: var(--radius, 12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.dm-empty-title { margin: 0; font-size: 18px; line-height: 1.3; font-weight: 600; }
.dm-empty-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.dm-empty-note { margin: 0; font-size: 13px; color: var(--muted, #9aa0b4); }

.dm-stage-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 14px; }
.dm-status {
  flex: 1 1 160px;
  min-width: 0;
  font-size: 14px;
  color: var(--muted, #9aa0b4);
  overflow-wrap: anywhere;
}
.dm-status.is-error { color: #ff7b7b; }

/* ---- buttons ---- */
.dm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius, 12px);
  border: 1px solid var(--line, #2a3046);
  background: var(--card, #1c2030);
  color: var(--text, #f2eee6);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: filter .15s ease;
}
.dm-btn:hover:not([disabled]) { filter: brightness(1.12); }
.dm-btn:focus-visible { outline: 2px solid var(--accent, #ff7a59); outline-offset: 2px; }
.dm-btn-primary { background: var(--primary, #ffb347); color: #1a1208; border-color: transparent; font-weight: 600; }
.dm-btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- control panel ---- */
.dm-panel {
  display: grid;
  gap: 18px;
  min-width: 0;
  max-width: 100%;
  padding: 18px;
  background: var(--card, #1c2030);
  border: 1px solid var(--line, #2a3046);
  border-radius: var(--radius, 12px);
}
.dm-group { display: block; min-width: 0; margin: 0; padding: 0; border: 0; }
.dm-group > * + * { margin-top: 10px; }
.dm-group legend,
.dm-group-title {
  padding: 0;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted, #9aa0b4);
}

/* radio chips: 2 columns on phones, 4 on desktop */
.dm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 880px) {
  .dm-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.dm-chip { position: relative; display: block; min-width: 0; cursor: pointer; }
.dm-chip input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.dm-chip span {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid var(--line, #2a3046);
  border-radius: var(--radius, 12px);
  background: var(--card, #1c2030);
  font-size: 14px;
  text-align: center;
  overflow-wrap: anywhere;
  transition: border-color .15s ease;
}
.dm-chip:hover span { border-color: var(--muted, #9aa0b4); }
.dm-chip input:checked + span { border-color: var(--primary, #ffb347); font-weight: 600; }
.dm-chip input:checked + span::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--primary, #ffb347);
  opacity: .18;                                   /* light tint under the label */
}
.dm-chip input:focus-visible + span { outline: 2px solid var(--accent, #ff7a59); outline-offset: 2px; }

.dm-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; }
.dm-row input[type=range] {
  grid-column: 1 / -1;
  width: 100%;
  margin: 8px 0 2px;
  accent-color: var(--primary, #ffb347);
}
.dm-row output { font-size: 14px; color: var(--muted, #9aa0b4); font-variant-numeric: tabular-nums; }
.dm-check { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: 15px; cursor: pointer; }
.dm-check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--primary, #ffb347); }

.dm-select {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line, #2a3046);
  border-radius: var(--radius, 12px);
  background: var(--card, #1c2030);
  color: var(--text, #f2eee6);
  font: inherit;
  font-size: 15px;
}

.dm-export-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 420px) {
  .dm-export-btns { grid-template-columns: minmax(0, 1fr); }
}
.dm-progress { display: block; width: 100%; height: 8px; accent-color: var(--primary, #ffb347); }
.dm-progress[hidden],
.dm-file[hidden] { display: none; }
