.esm-studio-gallery,.esm-template-preview {
  --studio-ink:#f8f5fc;
  --studio-muted:#c0b7ca;
  --studio-edge:#39323e;
  color:var(--studio-ink);
  box-sizing:border-box;
}
.esm-studio-gallery {width:100%;min-width:0;margin:18px 0 10px;text-align:left}
.esm-gallery-heading,.esm-template-toolbar,.esm-template-actions,.esm-gallery-filters {display:flex;align-items:center;gap:8px}
.esm-gallery-heading,.esm-template-toolbar {justify-content:space-between}
.esm-studio-gallery .esm-gallery-heading h3 {margin:0;color:var(--studio-ink);font-size:1.02rem;letter-spacing:-.025em;line-height:1.4}
.esm-studio-gallery button,.esm-template-preview button {font:inherit;cursor:pointer;color:inherit}
.esm-studio-gallery .esm-gallery-more,.esm-studio-gallery .esm-gallery-filters button {
  min-height:36px;width:auto;margin:0;padding:5px 10px;background:transparent;border:1px solid transparent;
  box-shadow:none;color:var(--studio-muted);border-radius:999px;font-size:.8rem;font-weight:600;line-height:1.4;
}
.esm-gallery-filters {margin:3px 0 10px}
.esm-studio-gallery .esm-gallery-filters button {min-width:50px;background:#211d28;border-color:var(--studio-edge)}
:is(#esmImageStudio,#esmCutEditor) .esm-gallery-filters button[aria-pressed=true] {color:#21172c;background:#efdefa;border-color:#efdefa}
.esm-template-grid {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px}
.esm-studio-gallery .esm-studio-card {
  display:block;position:relative;isolation:isolate;overflow:hidden;aspect-ratio:4/5;width:100%;min-height:0;
  border:1px solid var(--studio-edge);border-radius:14px;background:#201c25;margin:0;padding:0;text-align:left;
}
.esm-studio-card img {position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.esm-studio-card::after {content:"";position:absolute;inset:40% 0 0;background:linear-gradient(transparent,rgba(10,6,14,.84));pointer-events:none}
.esm-template-play {position:absolute;top:9px;right:9px;background:#15101cbf;color:#fff;border:1px solid #ffffff4a;border-radius:50%;width:24px;height:24px;display:grid;place-items:center;font-size:10px}
.esm-template-caption {position:absolute;z-index:1;inset:auto 9px 10px;color:white;font-size:.87rem;line-height:1.35;font-weight:650;overflow-wrap:anywhere}
.esm-template-preview {
  width:min(460px,calc(100% - 24px));max-width:none;max-height:calc(100dvh - 28px);
  padding:0;margin:auto;border:1px solid #49424f;border-radius:22px;background:#18151d;box-shadow:0 18px 64px #0008;
  overscroll-behavior:contain;color-scheme:dark;
}
.esm-template-preview::backdrop {background:#060408ba}
.esm-template-inner {padding:12px 16px 16px}
.esm-template-toolbar {margin-bottom:8px}
.esm-template-toolbar small {color:var(--studio-muted);font-size:.8rem}
.esm-template-browsing {display:flex;align-items:center;gap:4px}
.esm-template-browsing button {width:38px;height:38px;display:grid;place-items:center;padding:0;border-radius:50%;border:1px solid var(--studio-edge);background:#242029;font-size:1.4rem;line-height:1}
.esm-template-preview button.esm-template-close {display:grid;place-items:center;background:transparent;color:var(--studio-ink);border:0;width:40px;height:40px;margin:0;padding:0;font-size:1.65rem;line-height:1}
.esm-template-media {width:100%;border-radius:14px;overflow:hidden;background:#08070a}
.esm-template-media :is(img,video) {display:block;width:100%;height:min(48dvh,400px);object-fit:contain;margin:0}
.esm-template-preview h3 {margin:14px 0 6px;color:var(--studio-ink);font-size:1.2rem}
.esm-template-description {margin:0;color:#d3cbdc;font-size:.9rem;line-height:1.6}
.esm-template-actions {margin-top:14px}
.esm-template-preview .esm-template-actions button {flex:1;min-height:44px;border-radius:12px;border:1px solid #4c4355;padding:8px;font-weight:650;font-size:.87rem}
.esm-template-preview .esm-template-use {background:#e5c9ff;color:#271336;border-color:transparent}
.esm-template-preview .esm-template-attach {background:#28222f;color:#f1e8fa}
.esm-template-preview button:disabled {opacity:.52;cursor:default}
.esm-studio-gallery button:focus-visible,.esm-template-preview button:focus-visible {outline:2px solid #9de8f3;outline-offset:2px}
.esm-template-status {margin:8px 0 0;font-size:.82rem;color:var(--studio-muted)}
.esm-template-status:empty {display:none}
@media (max-width:650px) {
  .esm-template-grid {grid-template-columns:repeat(2,minmax(0,1fr))}
  .esm-template-preview {width:100%;max-height:calc(100dvh - 12px);border-radius:20px 20px 0 0;margin:auto auto 0}
  .esm-template-inner {padding-bottom:max(16px,env(safe-area-inset-bottom))}
}

[data-esm-studio-gallery="image"] .esm-gallery-filters {
  flex-wrap:wrap;
}
[data-esm-studio-gallery="image"] .esm-gallery-filters button,
[data-esm-studio-gallery="image"] .esm-gallery-more {
  min-height:42px;
  font-size:.875rem;
}
#esmImageExamples, #esmImageGallery, #esmImageGallery .esm-gallery-topic {
  min-inline-size:0;
  max-inline-size:100%;
}
#esmImageGallery {margin:0}
#esmImageGallery .esm-gallery-filters {
  display:flex;
  flex-wrap:nowrap;
  gap:6px;
  margin:0 0 10px;
  padding:3px;
  overflow-x:auto;
  overscroll-behavior-x:contain;
  scrollbar-width:thin;
}
#esmImageGallery .esm-gallery-filters button {flex:0 0 auto;white-space:nowrap}
#esmImageGallery .esm-gallery-heading {margin:0 0 8px}
#esmImageGallery .esm-template-grid {grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
#esmImageGallery .esm-template-grid.esm-gallery-grouped {display:flex;flex-direction:column;gap:16px}
#esmImageGallery .esm-gallery-topic h4 {
  color:var(--studio-ink);
  font-size:.92rem;
  line-height:1.4;
  margin:0 0 6px;
}
#esmImageGallery .esm-gallery-rail {
  display:grid;
  grid-auto-flow:column;
  grid-auto-columns:calc((100% - 14px) / 3);
  gap:7px;
  overflow-x:auto;
  overscroll-behavior-x:contain;
  scroll-snap-type:x proximity;
  scrollbar-width:thin;
  scrollbar-color:#554a5e transparent;
}
#esmImageGallery .esm-gallery-rail .esm-studio-card {scroll-snap-align:start}
#esmImageGallery .esm-studio-card {aspect-ratio:3 / 4;border-radius:9px}
#esmImageGallery .esm-studio-card:focus-visible {outline-offset:-3px;outline:3px solid #9de8f3}
#esmImageGallery .esm-template-caption {
  inset:auto 6px 6px;
  font-size:clamp(.7rem,2.8vw,.88rem);
  line-height:1.23;
  text-shadow:0 1px 3px #000b;
}

