/* EMII Gallery Viewer v5.41 */
.emii-gallery-viewer {
  width: min(980px, calc(100vw - 28px));
  max-height: min(92vh, 860px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 14px;
  border-radius: 28px;
  overflow: hidden;
}

.emii-gallery-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}

.emii-gallery-title-block {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.emii-gallery-title-block strong,
.emii-gallery-title-block span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emii-gallery-title-block span,
.emii-gallery-counter,
.emii-gallery-zoom-value {
  color: var(--emii-muted);
  font-size: 12px;
}

.emii-gallery-counter {
  min-width: 54px;
  text-align: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--emii-soft);
}

.emii-gallery-stage {
  min-height: 280px;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: color-mix(in srgb, var(--emii-surface) 62%, transparent);
  border: 1px solid var(--emii-border);
  overflow: hidden;
  touch-action: pan-y;
  outline: none;
}

.emii-gallery-figure {
  width: 100%;
  height: 100%;
  min-height: 280px;
  margin: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  cursor: grab;
}

.emii-gallery-figure img {
  max-width: calc(100% - 28px);
  max-height: calc(100% - 28px);
  border-radius: 18px;
  object-fit: contain;
  transform: translate3d(var(--emii-gallery-pan-x, 0px), var(--emii-gallery-pan-y, 0px), 0) scale(var(--emii-gallery-zoom, 1));
  transform-origin: center;
  transition: transform .18s ease;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  box-shadow: 0 22px 60px rgba(0,0,0,.24);
}

.emii-gallery-file {
  width: min(320px, 84%);
  min-height: 180px;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 24px;
  border-radius: 24px;
  background: var(--emii-soft);
  color: var(--emii-text);
  text-align: center;
}

.emii-gallery-file b {
  font-size: 32px;
}

.emii-gallery-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 46px;
  height: 46px;
  border: 1px solid var(--emii-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--emii-surface) 84%, transparent);
  color: var(--emii-text);
  display: grid;
  place-items: center;
  font-size: 30px;
  line-height: 1;
  transform: translateY(-50%);
  box-shadow: var(--emii-shadow-sm);
  cursor: pointer;
}

.emii-gallery-nav.is-prev { right: 14px; }
.emii-gallery-nav.is-next { left: 14px; }

.emii-gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 2px 0;
}

.emii-gallery-tool {
  min-height: 34px;
  min-width: 38px;
  border: 1px solid var(--emii-border);
  border-radius: 999px;
  background: var(--emii-soft);
  color: var(--emii-text);
  padding: 0 12px;
  cursor: pointer;
}

.emii-gallery-tool:active,
.emii-gallery-nav:active,
.emii-gallery-thumb:active {
  transform: scale(.97);
}

.emii-gallery-nav:active { transform: translateY(-50%) scale(.97); }

.emii-gallery-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 4px 2px 2px;
  scrollbar-width: thin;
}

.emii-gallery-thumb {
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  border: 2px solid transparent;
  border-radius: 15px;
  background: var(--emii-soft);
  overflow: hidden;
  padding: 0;
  cursor: pointer;
}

.emii-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.emii-gallery-thumb.is-active {
  border-color: var(--emii-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--emii-primary) 14%, transparent);
}

[data-theme="dark"] .emii-gallery-stage,
.emii-theme-dark .emii-gallery-stage {
  background: rgba(255,255,255,.045);
}

@media (max-width: 920px) {
  .emii-gallery-viewer {
    width: calc(100vw - 18px);
    max-height: calc(100vh - max(18px, env(safe-area-inset-top, 0px)) - max(18px, env(safe-area-inset-bottom, 0px)));
    border-radius: 24px;
    padding: 10px;
    gap: 10px;
  }

  .emii-gallery-head {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .emii-gallery-stage,
  .emii-gallery-figure {
    min-height: min(58vh, 460px);
  }

  .emii-gallery-nav {
    width: 40px;
    height: 40px;
    font-size: 26px;
  }

  .emii-gallery-nav.is-prev { right: 8px; }
  .emii-gallery-nav.is-next { left: 8px; }

  .emii-gallery-toolbar {
    justify-content: space-between;
    padding-inline: 2px;
  }

  .emii-gallery-tool {
    min-height: 36px;
    min-width: 40px;
    padding-inline: 10px;
  }

  .emii-gallery-thumb {
    flex-basis: 54px;
    width: 54px;
    height: 54px;
  }
}

.emii-gallery-demo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.emii-gallery-demo-card {
  min-height: 126px;
  border: 1px solid var(--emii-border);
  border-radius: 20px;
  background: var(--emii-soft);
  color: #fff;
  padding: 0;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  box-shadow: var(--emii-shadow-sm);
}

.emii-gallery-demo-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: center / cover no-repeat var(--emii-gallery-demo-src, transparent);
}

.emii-gallery-demo-card span {
  position: absolute;
  inset-inline: 10px;
  bottom: 10px;
  z-index: 1;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(0,0,0,.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 12px;
  font-weight: 800;
}

.emii-gallery-demo-card[data-emii-gallery-src] {
  background-image: var(--emii-gallery-demo-src);
}

.emii-gallery-demo-card:nth-child(1)::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 360 260'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='1' y1='0' y2='1'%3E%3Cstop stop-color='%23007aff'/%3E%3Cstop offset='1' stop-color='%235856d6'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='360' height='260' rx='42' fill='url(%23g)'/%3E%3Ccircle cx='122' cy='112' r='44' fill='rgba(255,255,255,.32)'/%3E%3Cpath d='M58 205 146 132l58 54 42-38 62 57z' fill='rgba(255,255,255,.58)'/%3E%3C/svg%3E"); }
.emii-gallery-demo-card:nth-child(2)::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 360 260'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='1' y1='0' y2='1'%3E%3Cstop stop-color='%23ff9500'/%3E%3Cstop offset='1' stop-color='%23ff2d55'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='360' height='260' rx='42' fill='url(%23g)'/%3E%3Crect x='84' y='58' width='192' height='132' rx='24' fill='rgba(255,255,255,.31)'/%3E%3Crect x='118' y='96' width='124' height='20' rx='10' fill='rgba(255,255,255,.56)'/%3E%3Crect x='132' y='132' width='96' height='18' rx='9' fill='rgba(255,255,255,.45)'/%3E%3C/svg%3E"); }
.emii-gallery-demo-card:nth-child(3)::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 360 260'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='1' y1='0' y2='1'%3E%3Cstop stop-color='%2334c759'/%3E%3Cstop offset='1' stop-color='%2300c7be'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='360' height='260' rx='42' fill='url(%23g)'/%3E%3Ccircle cx='180' cy='130' r='70' fill='rgba(255,255,255,.24)'/%3E%3Ccircle cx='180' cy='130' r='42' fill='rgba(255,255,255,.42)'/%3E%3Cpath d='M208 158l42 42' stroke='rgba(255,255,255,.72)' stroke-width='18' stroke-linecap='round'/%3E%3C/svg%3E"); }

@media (max-width: 680px) {
  .emii-gallery-demo-grid {
    grid-template-columns: 1fr;
  }
}


/* v5.38 — iOS Photos style mobile viewer and optional gallery actions */
.emii-gallery-zoom-tools,
.emii-gallery-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.emii-gallery-toolbar {
  flex-wrap: wrap;
}

.emii-gallery-action {
  min-height: 34px;
  border: 1px solid var(--emii-border);
  border-radius: 999px;
  background: var(--emii-soft);
  color: var(--emii-text);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 850;
}

.emii-gallery-action.is-danger {
  color: var(--emii-red);
  background: color-mix(in srgb, var(--emii-red) 11%, var(--emii-soft));
}

.emii-gallery-action b {
  font-size: 15px;
  line-height: 1;
}

@media (max-width: 920px) {
  .emii-gallery-viewer.is-ios-photo {
    right: 0;
    top: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    padding: 0;
    gap: 0;
    grid-template-rows: minmax(0, 1fr);
    background: #000;
    border: 0;
    box-shadow: none;
    overflow: hidden;
    color: #fff;
    transform: translate(0, 0) scale(.98);
  }

  .emii-gallery-viewer.is-ios-photo.is-open {
    transform: translate(0, 0) scale(1);
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-head {
    position: absolute;
    z-index: 8;
    top: 0;
    inset-inline: 0;
    min-height: calc(56px + env(safe-area-inset-top, 0px));
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
    background: linear-gradient(180deg, rgba(0,0,0,.78), rgba(0,0,0,.28), transparent);
    color: #fff;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-title-block span,
  .emii-gallery-viewer.is-ios-photo .emii-gallery-counter,
  .emii-gallery-viewer.is-ios-photo .emii-gallery-zoom-value {
    color: rgba(255,255,255,.72);
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-counter,
  .emii-gallery-viewer.is-ios-photo .emii-icon-btn,
  .emii-gallery-viewer.is-ios-photo .emii-gallery-tool,
  .emii-gallery-viewer.is-ios-photo .emii-gallery-action {
    background: rgba(28,28,30,.66);
    border-color: rgba(255,255,255,.12);
    color: #fff;
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-action.is-danger {
    color: #ff453a;
    background: rgba(255,69,58,.18);
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-stage,
  .emii-gallery-viewer.is-ios-photo .emii-gallery-figure {
    min-height: 100dvh;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    border: 0;
    background: #000;
    touch-action: pan-y;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-figure {
    overflow: hidden;
    cursor: grab;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-figure img {
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-nav {
    top: 50%;
    opacity: .82;
    background: rgba(28,28,30,.48);
    border-color: rgba(255,255,255,.10);
    color: #fff;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-toolbar {
    position: absolute;
    z-index: 8;
    inset-inline: 0;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    padding: 0 12px;
    justify-content: center;
    gap: 8px;
    pointer-events: none;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-zoom-tools,
  .emii-gallery-viewer.is-ios-photo .emii-gallery-actions {
    pointer-events: auto;
    padding: 6px;
    border-radius: 999px;
    background: rgba(0,0,0,.32);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-thumbs {
    position: absolute;
    z-index: 8;
    inset-inline: 0;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    padding: 8px 12px;
    background: linear-gradient(0deg, rgba(0,0,0,.72), rgba(0,0,0,.12), transparent);
    scrollbar-width: none;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-thumbs::-webkit-scrollbar {
    display: none;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-thumb {
    flex-basis: 52px;
    width: 52px;
    height: 52px;
    border-radius: 13px;
    background: rgba(255,255,255,.08);
  }
}

/* v5.39 — iOS Photos polish: light default, glass header/actions, zoom-safe swipe */
.emii-gallery-back,
.emii-gallery-menu {
  min-width: 40px;
  min-height: 38px;
  border: 1px solid var(--emii-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--emii-surface) 74%, transparent);
  color: var(--emii-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding-inline: 10px;
  font-weight: 850;
  cursor: pointer;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.emii-gallery-back {
  font-size: 20px;
}

.emii-gallery-back span {
  font-size: 12px;
}

.emii-gallery-menu {
  letter-spacing: -2px;
  direction: ltr;
}

.emii-gallery-viewer.is-zoomed .emii-gallery-stage,
.emii-gallery-viewer.is-zoomed .emii-gallery-figure {
  touch-action: none;
}

.emii-gallery-viewer.is-zoomed .emii-gallery-nav {
  opacity: .32;
}

.emii-gallery-viewer.is-zoomed .emii-gallery-figure {
  cursor: grab;
}

.emii-gallery-viewer.is-panning .emii-gallery-figure {
  cursor: grabbing;
}

.emii-gallery-viewer.is-panning .emii-gallery-figure img,
.emii-gallery-viewer.is-zoomed .emii-gallery-figure img {
  transition: none;
}

@media (max-width: 920px) {
  .emii-gallery-viewer.is-ios-photo {
    background: #f7f7fb;
    color: #111827;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-head {
    min-height: calc(58px + env(safe-area-inset-top, 0px));
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 8px;
    background: linear-gradient(180deg, rgba(247,247,251,.94), rgba(247,247,251,.60), rgba(247,247,251,0));
    display: grid;
    grid-template-columns: minmax(78px, auto) minmax(0, 1fr) minmax(46px, auto);
    align-items: start;
    gap: 8px;
    direction: ltr;
    color: #111827;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-back {
    grid-column: 1;
    justify-self: start;
    direction: rtl;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-title-block {
    grid-column: 2;
    justify-self: center;
    min-width: 0;
    max-width: min(52vw, 320px);
    padding: 6px 12px;
    border: 1px solid rgba(17,24,39,.08);
    border-radius: 999px;
    background: rgba(255,255,255,.68);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    text-align: center;
    direction: rtl;
    box-shadow: 0 8px 24px rgba(15,23,42,.06);
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-title-block strong,
  .emii-gallery-viewer.is-ios-photo .emii-gallery-title-block span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-title-block span,
  .emii-gallery-viewer.is-ios-photo .emii-gallery-counter,
  .emii-gallery-viewer.is-ios-photo .emii-gallery-zoom-value {
    color: rgba(17,24,39,.62);
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-menu {
    grid-column: 3;
    justify-self: end;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-counter,
  .emii-gallery-viewer.is-ios-photo .emii-gallery-back,
  .emii-gallery-viewer.is-ios-photo .emii-gallery-menu,
  .emii-gallery-viewer.is-ios-photo .emii-gallery-tool,
  .emii-gallery-viewer.is-ios-photo .emii-gallery-action {
    background: rgba(255,255,255,.72);
    border-color: rgba(17,24,39,.08);
    color: #111827;
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    box-shadow: 0 8px 24px rgba(15,23,42,.08);
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-action.is-danger {
    color: #dc2626;
    background: rgba(255,255,255,.78);
    border-color: rgba(220,38,38,.16);
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-stage,
  .emii-gallery-viewer.is-ios-photo .emii-gallery-figure {
    min-height: 100dvh;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    border: 0;
    background: #f7f7fb;
    touch-action: pan-y;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-figure img {
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-nav {
    background: rgba(255,255,255,.58);
    border-color: rgba(17,24,39,.08);
    color: #111827;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-toolbar {
    position: absolute;
    z-index: 8;
    inset-inline: 0;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    min-height: 48px;
    padding: 0 12px;
    display: block;
    pointer-events: none;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-zoom-tools {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    pointer-events: auto;
    padding: 6px;
    border-radius: 999px;
    background: rgba(255,255,255,.68);
    border: 1px solid rgba(17,24,39,.08);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    box-shadow: 0 8px 24px rgba(15,23,42,.08);
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-actions {
    position: absolute;
    right: 12px;
    bottom: 0;
    pointer-events: auto;
    padding: 0;
    border-radius: 999px;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    justify-content: flex-end;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-actions .emii-gallery-action:not(.is-danger) {
    display: none;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-counter {
    position: absolute;
    left: 12px;
    bottom: 6px;
    min-height: 34px;
    min-width: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 850;
    pointer-events: auto;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-thumbs {
    position: absolute;
    z-index: 8;
    inset-inline: 0;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    padding: 8px 12px;
    background: linear-gradient(0deg, rgba(247,247,251,.84), rgba(247,247,251,.34), rgba(247,247,251,0));
    scrollbar-width: none;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-thumb {
    flex-basis: 52px;
    width: 52px;
    height: 52px;
    border-radius: 13px;
    background: rgba(255,255,255,.72);
    box-shadow: 0 8px 22px rgba(15,23,42,.09);
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-thumb.is-active {
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0,122,255,.18), 0 8px 22px rgba(15,23,42,.09);
  }

  [data-theme="dark"] .emii-gallery-viewer.is-ios-photo,
  .emii-theme-dark .emii-gallery-viewer.is-ios-photo {
    background: #111318;
    color: #f5f5f7;
  }

  [data-theme="dark"] .emii-gallery-viewer.is-ios-photo .emii-gallery-head,
  .emii-theme-dark .emii-gallery-viewer.is-ios-photo .emii-gallery-head {
    background: linear-gradient(180deg, rgba(17,19,24,.94), rgba(17,19,24,.58), rgba(17,19,24,0));
    color: #f5f5f7;
  }

  [data-theme="dark"] .emii-gallery-viewer.is-ios-photo .emii-gallery-stage,
  [data-theme="dark"] .emii-gallery-viewer.is-ios-photo .emii-gallery-figure,
  .emii-theme-dark .emii-gallery-viewer.is-ios-photo .emii-gallery-stage,
  .emii-theme-dark .emii-gallery-viewer.is-ios-photo .emii-gallery-figure {
    background: #111318;
  }

  [data-theme="dark"] .emii-gallery-viewer.is-ios-photo .emii-gallery-title-block,
  [data-theme="dark"] .emii-gallery-viewer.is-ios-photo .emii-gallery-counter,
  [data-theme="dark"] .emii-gallery-viewer.is-ios-photo .emii-gallery-back,
  [data-theme="dark"] .emii-gallery-viewer.is-ios-photo .emii-gallery-menu,
  [data-theme="dark"] .emii-gallery-viewer.is-ios-photo .emii-gallery-tool,
  [data-theme="dark"] .emii-gallery-viewer.is-ios-photo .emii-gallery-action,
  .emii-theme-dark .emii-gallery-viewer.is-ios-photo .emii-gallery-title-block,
  .emii-theme-dark .emii-gallery-viewer.is-ios-photo .emii-gallery-counter,
  .emii-theme-dark .emii-gallery-viewer.is-ios-photo .emii-gallery-back,
  .emii-theme-dark .emii-gallery-viewer.is-ios-photo .emii-gallery-menu,
  .emii-theme-dark .emii-gallery-viewer.is-ios-photo .emii-gallery-tool,
  .emii-theme-dark .emii-gallery-viewer.is-ios-photo .emii-gallery-action {
    background: rgba(31,33,38,.72);
    border-color: rgba(255,255,255,.10);
    color: #f5f5f7;
    box-shadow: 0 8px 24px rgba(0,0,0,.20);
  }

  [data-theme="dark"] .emii-gallery-viewer.is-ios-photo .emii-gallery-title-block span,
  [data-theme="dark"] .emii-gallery-viewer.is-ios-photo .emii-gallery-counter,
  [data-theme="dark"] .emii-gallery-viewer.is-ios-photo .emii-gallery-zoom-value,
  .emii-theme-dark .emii-gallery-viewer.is-ios-photo .emii-gallery-title-block span,
  .emii-theme-dark .emii-gallery-viewer.is-ios-photo .emii-gallery-counter,
  .emii-theme-dark .emii-gallery-viewer.is-ios-photo .emii-gallery-zoom-value {
    color: rgba(245,245,247,.68);
  }

  [data-theme="dark"] .emii-gallery-viewer.is-ios-photo .emii-gallery-zoom-tools,
  .emii-theme-dark .emii-gallery-viewer.is-ios-photo .emii-gallery-zoom-tools {
    background: rgba(31,33,38,.72);
    border-color: rgba(255,255,255,.10);
  }

  [data-theme="dark"] .emii-gallery-viewer.is-ios-photo .emii-gallery-thumbs,
  .emii-theme-dark .emii-gallery-viewer.is-ios-photo .emii-gallery-thumbs {
    background: linear-gradient(0deg, rgba(17,19,24,.88), rgba(17,19,24,.36), rgba(17,19,24,0));
  }

  [data-theme="dark"] .emii-gallery-viewer.is-ios-photo .emii-gallery-action.is-danger,
  .emii-theme-dark .emii-gallery-viewer.is-ios-photo .emii-gallery-action.is-danger {
    color: #ff6b61;
    background: rgba(52,24,25,.74);
    border-color: rgba(255,107,97,.18);
  }
}


/* v5.40 — Compact zoom tools: reset is an icon, hidden until zoomed */
.emii-gallery-zoom-tools {
  flex-wrap: nowrap;
  white-space: nowrap;
}

.emii-gallery-tool.is-reset[hidden] {
  display: none;
}

.emii-gallery-tool.is-reset {
  width: 34px;
  min-width: 34px;
  padding-inline: 0;
  font-size: 16px;
  line-height: 1;
}

@media (max-width: 920px) {
  .emii-gallery-viewer.is-ios-photo .emii-gallery-zoom-tools {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 4px;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-zoom-value {
    min-width: 42px;
    text-align: center;
    font-size: 11px;
    font-weight: 850;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-tool {
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
  }

  .emii-gallery-viewer.is-ios-photo .emii-gallery-tool.is-reset {
    margin-inline-start: 2px;
  }
}
